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

Functions don't follow Node.js error data callback convention. #288

Open
juliankrieger opened this issue Jul 20, 2022 · 1 comment
Open

Comments

@juliankrieger
Copy link

The functions in this library sadly do not follow the Node standard of

function(a, b, c, callback)

where callback is akin to

callback(err, data)

And err is an Error Object, while data is an object or array encompassing any possible result.

Instead they are defined with a callback like this

callback(err, ...data)

This makes these functions pretty hard to work with. For example, when trying to promisifying them with util.promisify they won't work, because util.promisify expects callbacks with at most two arguments.

Since there seems to be quite a large focus on Node standards, HTTP standards and standard cookie management throughout the entire library I've been wondering why the error data callback convention is not followed here.

@juliankrieger
Copy link
Author

juliankrieger commented Jul 20, 2022

Changing this is obviously a breaking change, but I think it would be worth it to think about since then all functions which accept callbacks fit neatly into the node standard library. Alternatively to breaking backwards compatibility with a 4.0 update, one could provide async alternatives of functions which are already features in this library.

I would be willing to open a PR which adds async alternatives for all functions where applicable.

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

No branches or pull requests

1 participant