Add size() cardinality helper across modules (eighth pass).
Standardize a size() method after isEmpty() on every module with clearAll(), delegating to domain counts or snapshot fields so callers can query occupancy without parsing snapshots. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -83,6 +83,10 @@ class HyperP2PCrdtVersionVector extends EventEmitter {
|
||||
return Object.keys(this.snapshot()).length === 0
|
||||
}
|
||||
|
||||
size () {
|
||||
return Object.keys(this.snapshot()).length
|
||||
}
|
||||
|
||||
get (peer) {
|
||||
return this._clock.get(assertPeer(peer)) || 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user