Added the underscore node_module.
All checks were successful
Auto Maintenance Cycle / pre-commit Autoupdate (push) Successful in 39s
All checks were successful
Auto Maintenance Cycle / pre-commit Autoupdate (push) Successful in 39s
This commit is contained in:
30
node_modules/underscore/cjs/_createReduce.js
generated
vendored
Normal file
30
node_modules/underscore/cjs/_createReduce.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
var _isArrayLike = require('./_isArrayLike.js');
|
||||
var keys = require('./keys.js');
|
||||
var _optimizeCb = require('./_optimizeCb.js');
|
||||
|
||||
// Internal helper to create a reducing function, iterating left or right.
|
||||
function createReduce(dir) {
|
||||
// Wrap code that reassigns argument variables in a separate function than
|
||||
// the one that accesses `arguments.length` to avoid a perf hit. (#1991)
|
||||
var reducer = function(obj, iteratee, memo, initial) {
|
||||
var _keys = !_isArrayLike(obj) && keys(obj),
|
||||
length = (_keys || obj).length,
|
||||
index = dir > 0 ? 0 : length - 1;
|
||||
if (!initial) {
|
||||
memo = obj[_keys ? _keys[index] : index];
|
||||
index += dir;
|
||||
}
|
||||
for (; index >= 0 && index < length; index += dir) {
|
||||
var currentKey = _keys ? _keys[index] : index;
|
||||
memo = iteratee(memo, obj[currentKey], currentKey, obj);
|
||||
}
|
||||
return memo;
|
||||
};
|
||||
|
||||
return function(obj, iteratee, memo, context) {
|
||||
var initial = arguments.length >= 3;
|
||||
return reducer(obj, _optimizeCb(iteratee, context, 4), memo, initial);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = createReduce;
|
Reference in New Issue
Block a user