Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # 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

@megawac megawac force-pushed the break-tester-loops branch from cbae8be to 509e3a7 Compare October 15, 2016 16:11
@hargasinski
Copy link
Collaborator

Looks good to me

@megawac megawac force-pushed the break-tester-loops branch from 096e474 to 74c01fe Compare October 16, 2016 00:05
@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 :))

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

Successfully merging this pull request may close these issues.

3 participants