Skip to content

Commit

Permalink
docs: Fix example in README.md (libp2p#54)
Browse files Browse the repository at this point in the history
Currently, the example fails with
> Module '"@libp2p/peer-id"' declares 'PeerId' locally, but it is not exported.ts(2459)

Replaced with a working example.

Co-authored-by: Alex Potsides <alex@achingbrain.net>
  • Loading branch information
laurentsenta and achingbrain committed Feb 23, 2023
1 parent ce4be90 commit 294a907
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/libp2p-peer-id/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ A basic implementation of a peer id
## Example

```JavaScript
import { PeerId } from '@libp2p/peer-id'
import { peerIdFromString } from '@libp2p/peer-id'

const id = new PeerId(...)
const peer = peerIdFromString('k51qzi5uqu5dkwkqm42v9j9kqcam2jiuvloi16g72i4i4amoo2m8u3ol3mqu6s')

console.log(id.toCid())
console.log(peer.toCid()) // CID(bafzaa...)
console.log(peer.toString()) // "12D3K..."
```

## API Docs
Expand Down

0 comments on commit 294a907

Please sign in to comment.