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

make api node style #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

plrthink
Copy link

@plrthink plrthink commented Oct 9, 2015

By making callback node style, the first argument of callback is error, users can use something like bluebird.promisify to convert the callback style to the promise style.

@darkrishabh
Copy link
Owner

This is a good change but it might be a breaking change for many.
I am kind of involved with some other stuff these days will merge it soon. untill then you can fix/ make sure it doesn't break the current applications

@kylegoetz
Copy link

It's been two years and this hasn't been merged. For anyone coming to this who only knows how to promisify using Bluebird or another third-party promisify function, here's how you do it with the add function as an example:

function myAdd(item) {
    return new Promise(resolve => db.add(item, result => resolve(result)))
}

myAdd will now return a promise that resolves to what db inserted.

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.

3 participants