Closed alanshaw closed 5 years ago
I'd like to propose adding a toString method to CID instances that calls or replaces toBaseEncodedString. It would make stringifying CIDs so much easier. I'd like to be able to:
toString
toBaseEncodedString
$ node > const CID = require('cids') > const cid = new CID('z8mWaJHXieAVxxLagBpdaNWFEBKVWmMiE') > console.log(`my cid: ${cid}`) my cid: [object Object] >
...but get back my cid: z8mWaJHXieAVxxLagBpdaNWFEBKVWmMiE
my cid: z8mWaJHXieAVxxLagBpdaNWFEBKVWmMiE
It's basically a 3 line addition:
toString (base) { return this.toBaseEncodedString(base) }
I'd like to propose adding a
toString
method to CID instances that calls or replacestoBaseEncodedString
. It would make stringifying CIDs so much easier. I'd like to be able to:...but get back
my cid: z8mWaJHXieAVxxLagBpdaNWFEBKVWmMiE
It's basically a 3 line addition: