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

How is Async going to support concat functions? #1437

Closed
suguru03 opened this issue Jun 12, 2017 · 2 comments
Closed

How is Async going to support concat functions? #1437

suguru03 opened this issue Jun 12, 2017 · 2 comments

Comments

@suguru03
Copy link
Contributor

suguru03 commented Jun 12, 2017

What version of async are you using?
v2.4.1

Which environment did the issue occur in (Node version/browser version)
Node v8.0.0

What did you do? Please include a minimal reproducable case illustrating issue.

async.concat([1, 2, 3], (val, next) => {
  next(null, val % 2 ? val : 0);
}, (err, result) => {
  console.log(result); // [1, 3]
});

What did you expect to happen?
If the function has the same functionality as Array.prototype.concat, it should be [1, 0, 3].

What was the actual result?
[1, 3]

Also I realized,

[].concat(0); // [0]
[].concat(); // []
[].concat(undefined); // [undefined]

I would like to know how Async is going to support the functions. Thanks :)

@aearly
Copy link
Collaborator

aearly commented Jun 12, 2017

Looks like we're just doing a truthy check here, when we should actually do y == null:

https://github.com/caolan/async/blob/master/lib/internal/concat.js#L5

@suguru03
Copy link
Contributor Author

Sure, I'll follow the PR changes, thanks :)

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

2 participants