Accessors length get length( ) : number Returns number Methods [iterator] [iterator] ( ) : IterableIterator < PeerId > Returns IterableIterator < PeerId > clear clear ( ) : void Returns void entries entries ( ) : IterableIterator < [ number , PeerId ] > Returns IterableIterator < [ number , PeerId ] > every every ( predicate ) : boolean Parameters predicate : ( ( peerId , index , arr ) => boolean ) ( peerId , index , arr ) : boolean Returns boolean Returns boolean filter filter ( predicate ) : PeerList Parameters predicate : ( ( peerId , index , arr ) => boolean ) ( peerId , index , arr ) : boolean Returns boolean find find ( predicate ) : undefined | PeerId Parameters predicate : ( ( peerId , index , arr ) => boolean ) ( peerId , index , arr ) : boolean Returns boolean Returns undefined | PeerId find Index find Index ( predicate ) : number Parameters predicate : ( ( peerId , index , arr ) => boolean ) ( peerId , index , arr ) : boolean Returns boolean Returns number for Each for Each ( predicate ) : void Parameters predicate : ( ( peerId , index , arr ) => void ) ( peerId , index , arr ) : void Returns void Returns void includes includes ( peerId ) : boolean Returns boolean index Of index Of ( peerId ) : number Returns number push push ( ... peerIds ) : void Returns void unshift unshift ( ... peerIds ) : 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