Skip to content

Commit

Permalink
docs: update example
Browse files Browse the repository at this point in the history
  • Loading branch information
2color committed Oct 17, 2024
1 parent c20a91c commit 69ee55d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/peer-id/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ An implementation of a peer id

```TypeScript
import { peerIdFromString } from '@libp2p/peer-id'
const peer = peerIdFromString('k51qzi5uqu5dkwkqm42v9j9kqcam2jiuvloi16g72i4i4amoo2m8u3ol3mqu6s')
import { base36 } from 'multiformats/bases/base36'

const peer = peerIdFromString('k51qzi5uqu5dkwkqm42v9j9kqcam2jiuvloi16g72i4i4amoo2m8u3ol3mqu6s', base36.decoder)

console.log(peer.toCID()) // CID(bafzaa...)
console.log(peer.toString()) // "12D3K..."
Expand Down
4 changes: 3 additions & 1 deletion packages/peer-id/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
*
* ```TypeScript
* import { peerIdFromString } from '@libp2p/peer-id'
* const peer = peerIdFromString('k51qzi5uqu5dkwkqm42v9j9kqcam2jiuvloi16g72i4i4amoo2m8u3ol3mqu6s')
* import { base36 } from 'multiformats/bases/base36'
*
* const peer = peerIdFromString('k51qzi5uqu5dkwkqm42v9j9kqcam2jiuvloi16g72i4i4amoo2m8u3ol3mqu6s', base36.decoder)
*
* console.log(peer.toCID()) // CID(bafzaa...)
* console.log(peer.toString()) // "12D3K..."
Expand Down

0 comments on commit 69ee55d

Please sign in to comment.