mirror of
https://github.com/thangisme/notes.git
synced 2024-11-01 02:27:20 -04:00
28 lines
780 B
JavaScript
28 lines
780 B
JavaScript
|
var apply = require('./_apply'),
|
||
|
arrayMap = require('./_arrayMap'),
|
||
|
baseIteratee = require('./_baseIteratee'),
|
||
|
baseRest = require('./_baseRest'),
|
||
|
baseUnary = require('./_baseUnary'),
|
||
|
flatRest = require('./_flatRest');
|
||
|
|
||
|
/**
|
||
|
* Creates a function like `_.over`.
|
||
|
*
|
||
|
* @private
|
||
|
* @param {Function} arrayFunc The function to iterate over iteratees.
|
||
|
* @returns {Function} Returns the new over function.
|
||
|
*/
|
||
|
function createOver(arrayFunc) {
|
||
|
return flatRest(function(iteratees) {
|
||
|
iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
|
||
|
return baseRest(function(args) {
|
||
|
var thisArg = this;
|
||
|
return arrayFunc(iteratees, function(iteratee) {
|
||
|
return apply(iteratee, thisArg, args);
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
module.exports = createOver;
|