Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bare export, no multiformats.codec() wrap #4

Merged
merged 1 commit into from
Oct 1, 2020

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Sep 30, 2020

In this variation of #3 we don't wrap in multiformats.codec() but just export { encode, decode, name, code, validate, prepare }. That can be passed as a bundle into multiformats.codec() by an upstream user, but you can also use them independently, along with the additional non-standard validate() and prepare(). The choices for imports are, as in the example.js import * as dagPB from '@ipld/dag-pb' and then use dagPB.encode() etc. as if it was already wrapped in a codec() but you also get dagPB.validate() and dagPB.prepare(). The type is pulling them out individually as in example-prepare.js import { prepare } from '@ipld/dag-pb'. Which is kind of nice.

We still need to pull in multiformats as a dependency for the CID powers internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant