-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add anyway version of map and parallel #531
Conversation
Hi @allevo, I'm not sure about the name. Perhaps something like |
Yes the problem is the name! Give me your preferred name for those functions. Are you interested in this pull request? |
@allevo yes, I'm interested in this, it's been asked for a few times. Mostly it's a question of API and naming rather than code. |
I've used "anyway" suffix to indicate the process goes on anyway if an error occurs. |
Another question -- would As for naming -- how about |
Each function returns an array (or object) where the errors are. https://github.com/allevo/async/blob/master/test/test-async.js#L807 https://github.com/allevo/async/blob/master/test/test-async.js#L1097 Here you can find the test of error case. |
Can't this be already accomplished with the existing methods? async.map([1, 2, 3, 4, 5], function (name, callback) {
fs.readFile(thing, function (err, data) {
callback(null, {
error: err,
data: data
});
});
}, function (err, results) {
// results[n].err is the error
// results[n].data is the value
}); |
Sorry for the late. |
Remove some console.log
If you don't like the interface, please tell me which you prefer! 👍 |
Is this PR blocked? I need this! |
I like this idea, but I dislike the global |
Nevermind, got PRs mixed up. |
+1 |
1 similar comment
+1 |
Why hasn't this been added yet? |
Because @caolan hasn't decided the names yet. As soon as possible, I'll resolve the conflict and repush the PR |
I realized that this breaks one of We're going to go back to the drawing board with #942 |
Use mapAnyway or parallelAnyway for doing something in parallel but if some tasks fail, the others will be executed anyway. In the final callback, the first parameter is valued with all errors. For mapAnyway, the second parameter with all mapped object.
Add main test for parallelAnyway and mapAnyway.