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

api #2

Closed
juliangruber opened this issue Mar 23, 2015 · 3 comments
Closed

api #2

juliangruber opened this issue Mar 23, 2015 · 3 comments
Labels
question Support or open question(s)

Comments

@juliangruber
Copy link
Member

This module currently has 2 apis, which differ in the way encodings are inherited. Those two snippets are equivalent:

value = encodeValue(value, [{ valueEncoding: 'hex' }, db.options]);
var codec = new Codec(db.options);
value = codec.encodeValue(value, { valueEncoding: 'hex' })

The first is more generic as it supports inheritance over n encoding options, whereas the second one works exactly with what we need in levelup.

We could change the class api to take n encoding options too:

var codec = new Codec([optionsA, optionsB]);
value = codec.encodeValue(value, [optionsC, optionsD]);

I guess the real question is: Do we want to make this module truly generic, or tie it to it's main use cases: levelup and multilevel.

Input from people having to use levelup's codec logic would help a lot.

@ralphtheninja @dominictarr @substack

@juliangruber juliangruber added the question Support or open question(s) label Mar 23, 2015
@ralphtheninja
Copy link
Member

@juliangruber Do you need it to be more generic for e.g. multilevel? I guess since we are moving this out already and also bumping levelup to 1.0.0 we have more freedom to do what we want.

What would the use case be for:

var codec = new Codec([optionsA, optionsB]);

?

@juliangruber
Copy link
Member Author

I doesn't need to be more generic for multilevel, so I guess it's safe to create an api that works best with levelup and multilevel...

@ralphtheninja
Copy link
Member

Yep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Support or open question(s)
Projects
None yet
Development

No branches or pull requests

2 participants