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:
@@ -143,6 +143,10 @@ class HyperP2PStreamMultiplex extends EventEmitter {
|
||||
return this.snapshot().open === 0
|
||||
}
|
||||
|
||||
size () {
|
||||
return this.snapshot().open
|
||||
}
|
||||
|
||||
openStreamBatch (ids) {
|
||||
if (!Array.isArray(ids)) throw new Error('ids array required')
|
||||
return ids.map((id) => this.openStream(id))
|
||||
|
||||
Reference in New Issue
Block a user