js-peer-id icon indicating copy to clipboard operation
js-peer-id copied to clipboard

Introduce `ToPeerId` type for things that can be turned into PeerId

Open Gozala opened this issue 4 years ago • 1 comments

Based on discussion here https://github.com/ipfs/js-ipfs/pull/3365/files/fa7c2c13c43bab922052104fe8aff863d9725e9b?file-filters%5B%5D=.js&file-filters%5B%5D=.json&file-filters%5B%5D=.ts#r520418521

Gozala avatar Nov 12 '20 23:11 Gozala

Cross posting from https://github.com/ipfs/js-ipfs/pull/3365/files/fa7c2c13c43bab922052104fe8aff863d9725e9b?file-filters%5B%5D=.js&file-filters%5B%5D=.json&file-filters%5B%5D=.ts#r522871631

We already have several createFrom* functions in peer-id, but they are targeted to a specific type https://github.com/libp2p/js-peer-id#import I think this would be nice to have, I would just go with PeerId.createFrom(param: ToPeerId) to be consistent with what we already have.

vasco-santos avatar Nov 13 '20 10:11 vasco-santos