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

Three arguments #9

Closed
dcousens opened this issue Nov 19, 2018 · 3 comments
Closed

Three arguments #9

dcousens opened this issue Nov 19, 2018 · 3 comments
Labels

Comments

@dcousens
Copy link

dcousens commented Nov 19, 2018

universalify does not support calling the callback with more than three arguments

Where does this limit appear?
The limits I found were:

universalify/index.js

Lines 8 to 11 in ab4b5cd

arguments[arguments.length] = (err, res) => {
if (err) return reject(err)
resolve(res)
}

That indicates you only support err and res. eg (err => res => void).

else fn.apply(this, arguments).then(r => cb(null, r), cb)

And the same here.

@RyanZim
Copy link
Owner

RyanZim commented Nov 19, 2018

You're correct, those are the only limits.

My point was that universalify doesn't work with things like fs.read(), which has a callback with arguments of the form: (err, bytesRead, buffer). For such a case, universalify won't pass the buffer argument as part of the promise resolution value.

There's nothing that expressly prevents you from using universalify with such functions if you don't care about the third argument, it's just a warning that universalify won't handle the third argument.

@dcousens
Copy link
Author

Ok. So it is a typo? s/three/two? Or have I miscount?

@RyanZim
Copy link
Owner

RyanZim commented Nov 19, 2018

Ah, yes, it's a typo in the docs, and I totally misread it here as well. Should read:

universalify does not support calling the callback with three or more arguments

Good catch; thanks!

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

No branches or pull requests

2 participants