mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
733 B
26 lines
733 B
var apply = require('./_apply'),
|
|
arrayMap = require('./_arrayMap'),
|
|
baseFlatten = require('./_baseFlatten'),
|
|
baseIteratee = require('./_baseIteratee'),
|
|
rest = require('./rest');
|
|
|
|
/**
|
|
* Creates a function like `_.over`.
|
|
*
|
|
* @private
|
|
* @param {Function} arrayFunc The function to iterate over iteratees.
|
|
* @returns {Function} Returns the new invoker function.
|
|
*/
|
|
function createOver(arrayFunc) {
|
|
return rest(function(iteratees) {
|
|
iteratees = arrayMap(baseFlatten(iteratees), baseIteratee);
|
|
return rest(function(args) {
|
|
var thisArg = this;
|
|
return arrayFunc(iteratees, function(iteratee) {
|
|
return apply(iteratee, thisArg, args);
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
module.exports = createOver;
|
|
|