Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@libp2p/peer-collections

Package Overview
Dependencies
Maintainers
6
Versions
562
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/peer-collections - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

3

dist/src/set.d.ts

@@ -22,3 +22,6 @@ import type { PeerId } from '@libp2p/interface-peer-id';

values(): IterableIterator<PeerId>;
intersection(other: PeerSet): PeerSet;
difference(other: PeerSet): PeerSet;
union(other: PeerSet): PeerSet;
}
//# sourceMappingURL=set.d.ts.map

@@ -55,3 +55,31 @@ import { peerIdFromString } from '@libp2p/peer-id';

}
intersection(other) {
const output = new PeerSet();
for (const peerId of other) {
if (this.has(peerId)) {
output.add(peerId);
}
}
return output;
}
difference(other) {
const output = new PeerSet();
for (const peerId of this) {
if (!other.has(peerId)) {
output.add(peerId);
}
}
return output;
}
union(other) {
const output = new PeerSet();
for (const peerId of other) {
output.add(peerId);
}
for (const peerId of this) {
output.add(peerId);
}
return output;
}
}
//# sourceMappingURL=set.js.map

2

package.json
{
"name": "@libp2p/peer-collections",
"version": "2.1.0",
"version": "2.2.0",
"description": "Stores values against a peer id",

@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT",

@@ -26,3 +26,3 @@ import type { PeerId } from '@libp2p/interface-peer-id'

[Symbol.iterator] () {
[Symbol.iterator] (): IterableIterator<PeerId> {
return mapIterable<[number, string], PeerId>(

@@ -36,3 +36,3 @@ this.list.entries(),

concat (list: PeerList) {
concat (list: PeerList): PeerList {
const output = new PeerList(this)

@@ -118,3 +118,3 @@

push (...peerIds: PeerId[]) {
push (...peerIds: PeerId[]): void {
for (const peerId of peerIds) {

@@ -135,3 +135,3 @@ this.list.push(peerId.toString())

unshift (...peerIds: PeerId[]) {
unshift (...peerIds: PeerId[]): number {
let len = this.list.length

@@ -146,5 +146,5 @@

get length () {
get length (): number {
return this.list.length
}
}

@@ -26,11 +26,11 @@ import type { PeerId } from '@libp2p/interface-peer-id'

[Symbol.iterator] () {
[Symbol.iterator] (): IterableIterator<[PeerId, T]> {
return this.entries()
}
clear () {
clear (): void {
this.map.clear()
}
delete (peer: PeerId) {
delete (peer: PeerId): void {
this.map.delete(peer.toString())

@@ -62,3 +62,3 @@ }

set (peer: PeerId, value: T) {
set (peer: PeerId, value: T): void {
this.map.set(peer.toString(), value)

@@ -76,9 +76,9 @@ }

values () {
values (): IterableIterator<T> {
return this.map.values()
}
get size () {
get size (): number {
return this.map.size
}
}

@@ -26,19 +26,19 @@ import type { PeerId } from '@libp2p/interface-peer-id'

get size () {
get size (): number {
return this.set.size
}
[Symbol.iterator] () {
[Symbol.iterator] (): IterableIterator<PeerId> {
return this.values()
}
add (peer: PeerId) {
add (peer: PeerId): void {
this.set.add(peer.toString())
}
clear () {
clear (): void {
this.set.clear()
}
delete (peer: PeerId) {
delete (peer: PeerId): void {
this.set.delete(peer.toString())

@@ -70,3 +70,3 @@ }

values () {
values (): IterableIterator<PeerId> {
return mapIterable<string, PeerId>(

@@ -79,2 +79,40 @@ this.set.values(),

}
intersection (other: PeerSet): PeerSet {
const output = new PeerSet()
for (const peerId of other) {
if (this.has(peerId)) {
output.add(peerId)
}
}
return output
}
difference (other: PeerSet): PeerSet {
const output = new PeerSet()
for (const peerId of this) {
if (!other.has(peerId)) {
output.add(peerId)
}
}
return output
}
union (other: PeerSet): PeerSet {
const output = new PeerSet()
for (const peerId of other) {
output.add(peerId)
}
for (const peerId of this) {
output.add(peerId)
}
return output
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc