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

Short circuit loops completely for some,every,detect when ready #1306

Merged
merged 2 commits into from Oct 16, 2016

Conversation

megawac
Copy link
Collaborator

@megawac megawac commented Oct 15, 2016

Add the ability to short circuit eachLimit and eachSeries loops internally. Break loops when value is determined for some, every and detect/find

Fixes #1293

@hargasinski
Copy link
Collaborator

Looks good to me

@megawac megawac merged commit 173f878 into master Oct 16, 2016
@megawac megawac deleted the break-tester-loops branch October 16, 2016 00:12
let calls = 0;
async.everyLimit(arr, 100, function(data, cb) {
calls += 1;
async.setImmediate(_.partial(cb, null, false));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, setImmediate will partially apply params for you, no need for _.partial

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought our implementation didn't (though didn't check :))

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

Successfully merging this pull request may close these issues.

None yet

3 participants