Properties
Private
Readonly
list
list: string []
Accessors
length
get length( ) : number
Returns number
Methods
[iterator]
[iterator]( ) : IterableIterator < PeerId >
Returns IterableIterator < PeerId >
entries
entries( ) : IterableIterator < [ number , PeerId ] >
Returns IterableIterator < [ number , PeerId ] >
every
every( predicate: ( ( peerId: PeerId , index: number , arr: PeerList ) => boolean ) ) : boolean
Parameters
predicate: ( ( peerId: PeerId , index: number , arr: PeerList ) => boolean )
( peerId: PeerId , index: number , arr: PeerList ) : boolean
Returns boolean
Returns boolean
find
find( predicate: ( ( peerId: PeerId , index: number , arr: PeerList ) => boolean ) ) : undefined | PeerId
Parameters
predicate: ( ( peerId: PeerId , index: number , arr: PeerList ) => boolean )
( peerId: PeerId , index: number , arr: PeerList ) : boolean
Returns boolean
Returns undefined | PeerId
find Index
find Index( predicate: ( ( peerId: PeerId , index: number , arr: PeerList ) => boolean ) ) : number
Parameters
predicate: ( ( peerId: PeerId , index: number , arr: PeerList ) => boolean )
( peerId: PeerId , index: number , arr: PeerList ) : boolean
Returns boolean
Returns number
for Each
for Each( predicate: ( ( peerId: PeerId , index: number , arr: PeerList ) => void ) ) : void
Returns void
includes
includes( peerId: PeerId ) : boolean
Returns boolean
index Of
index Of( peerId: PeerId ) : number
Returns number
push
push( ... peerIds: PeerId [] ) : void
Returns void
unshift
unshift( ... peerIds: PeerId [] ) : number
Returns number
We can't use PeerIds as list entries because list entries are compared using same-value-zero equality, so this is just a map that stringifies the PeerIds before storing them.
PeerIds cache stringified versions of themselves so this should be a cheap operation.
Example