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

Example of excludeMain option is not correct #39

Closed
DanSnow opened this issue Feb 16, 2017 · 3 comments · Fixed by #40
Closed

Example of excludeMain option is not correct #39

DanSnow opened this issue Feb 16, 2017 · 3 comments · Fixed by #40

Comments

@DanSnow
Copy link
Contributor

DanSnow commented Feb 16, 2017

fn.method = (data, callback) => {
    setImmediate(() => {
        callback(data, null);
    });
};

Here call the callback with data, error order .
But the order shouldn't be error, data?

promiseFn.method('hi').then(data => {
    console.log(data);
});

The promise return by the method will be rejected.
Here is a code snippet on runkit.

DanSnow added a commit to DanSnow/pify that referenced this issue Feb 16, 2017
@schnittstabil
Copy link
Contributor

Pify only supports only Node.js style callbacks, from the API documentation:

[…] the callback function is called with the Error object (if any) passed as the first argument. If no error was raised, the first argument will be passed as null.

function nodeStyleCallback(err, data) {}

@DanSnow Thus your issue is somehow a duplicate of #31.

@DanSnow
Copy link
Contributor Author

DanSnow commented Feb 16, 2017

I'm not requesting a support for non-Node.js style API.
I mean that current readme.md has an error in examples.
I have opened a pull request #40.

@schnittstabil
Copy link
Contributor

👍 Many thanks for clarification.

schnittstabil pushed a commit that referenced this issue Feb 16, 2017
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 a pull request may close this issue.

2 participants