-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: remove partial application feature of applyEach (#1640)
* BREAKING CHANGE: remove partial application feature of applyEach * add awaitable tests for applyEach
- Loading branch information
Showing
6 changed files
with
34 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
import initialParams from './initialParams'; | ||
import wrapAsync from './wrapAsync'; | ||
import awaitify from './awaitify' | ||
|
||
export default function applyEach(eachfn) { | ||
return function(fns, ...callArgs) { | ||
var go = initialParams(function(args, callback) { | ||
export default function (eachfn) { | ||
return function applyEach(fns, ...callArgs) { | ||
const go = awaitify(function (callback) { | ||
var that = this; | ||
return eachfn(fns, (fn, cb) => { | ||
wrapAsync(fn).apply(that, args.concat(cb)); | ||
wrapAsync(fn).apply(that, callArgs.concat(cb)); | ||
}, callback); | ||
}); | ||
if (callArgs.length) { | ||
return go.apply(this, callArgs); | ||
} | ||
return go; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters