@libp2p/peer-collections 5.0.0-5a9362e21 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/typedoc-urls.json +5 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -11,6 +11,33 @@ We can't use PeerIds as collection keys because collection keys are compared usi
|
|
|
11
11
|
|
|
12
12
|
PeerIds cache stringified versions of themselves so this should be a cheap operation.
|
|
13
13
|
|
|
14
|
+
## Example - Peer lists
|
|
15
|
+
|
|
16
|
+
```JavaScript
|
|
17
|
+
import { peerList } from '@libp2p/peer-collections'
|
|
18
|
+
|
|
19
|
+
const list = peerList()
|
|
20
|
+
list.push(peerId)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Example - Peer maps
|
|
24
|
+
|
|
25
|
+
```JavaScript
|
|
26
|
+
import { peerMap } from '@libp2p/peer-collections'
|
|
27
|
+
|
|
28
|
+
const map = peerMap<string>()
|
|
29
|
+
map.set(peerId, 'value')
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Example - Peer sets
|
|
33
|
+
|
|
34
|
+
```JavaScript
|
|
35
|
+
import { peerSet } from '@libp2p/peer-collections'
|
|
36
|
+
|
|
37
|
+
const set = peerSet()
|
|
38
|
+
set.add(peerId)
|
|
39
|
+
```
|
|
40
|
+
|
|
14
41
|
# Install
|
|
15
42
|
|
|
16
43
|
```console
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"PeerList": "https://libp2p.github.io/js-libp2p/classes/_libp2p_peer_collections.PeerList.html",
|
|
3
|
+
"PeerMap": "https://libp2p.github.io/js-libp2p/classes/_libp2p_peer_collections.PeerMap.html",
|
|
4
|
+
"PeerSet": "https://libp2p.github.io/js-libp2p/classes/_libp2p_peer_collections.PeerSet.html"
|
|
5
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/peer-collections",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Stores values against a peer id",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/peer-collections#readme",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"test:electron-main": "aegir test -t electron-main"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@libp2p/interface": "1.0.1
|
|
57
|
-
"@libp2p/peer-id": "4.0.1
|
|
56
|
+
"@libp2p/interface": "^1.0.1",
|
|
57
|
+
"@libp2p/peer-id": "^4.0.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@libp2p/peer-id-factory": "4.0.0
|
|
60
|
+
"@libp2p/peer-id-factory": "^4.0.0",
|
|
61
61
|
"aegir": "^41.0.2"
|
|
62
62
|
}
|
|
63
63
|
}
|