ipld / js-dag-cbor

dag-cbor codec for IPLD
Other
26 stars 17 forks source link

feat: export encode/decode -Options #113

Closed tabcat closed 9 months ago

tabcat commented 9 months ago

These options are being exported so they can be used with cborg's API, specifically the decodeFirst and encodedLength functions.

Closes https://github.com/ipld/js-dag-cbor/issues/112

rvagg commented 9 months ago

Ah ok, I imagined you'd do a decodeFirst. I think I would prefer to not export the same options that are used in the encode and decode operations because I don't think it'd be healthy to introduce a way to be able to change those options. Maybe you could make a private objects and assemble or Object.assign them for the exported form as separate from the ones used internally. Note that the tags and typeEncoders would also need to be nested copied so that they can't be messed with.

rvagg commented 9 months ago

awesome, expect a semver-minor release soon with this, thanks!