Add files
This commit is contained in:
commit
bb80829159
18195 changed files with 2122994 additions and 0 deletions
31
509bba0_unpacked_with_node_modules/~/reduce-component/index.js
generated
Executable file
31
509bba0_unpacked_with_node_modules/~/reduce-component/index.js
generated
Executable file
|
@ -0,0 +1,31 @@
|
|||
|
||||
/**
|
||||
* Reduce `arr` with `fn`.
|
||||
*
|
||||
* @param {Array} arr
|
||||
* @param {Function} fn
|
||||
* @param {Mixed} initial
|
||||
*
|
||||
* TODO: combatible error handling?
|
||||
*/
|
||||
|
||||
module.exports = function(arr, fn, initial){
|
||||
var idx = 0;
|
||||
var len = arr.length;
|
||||
var curr = arguments.length == 3
|
||||
? initial
|
||||
: arr[idx++];
|
||||
|
||||
while (idx < len) {
|
||||
curr = fn.call(null, curr, arr[idx], ++idx, arr);
|
||||
}
|
||||
|
||||
return curr;
|
||||
};
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/reduce-component/index.js
|
||||
// module id = 2869
|
||||
// module chunks = 4
|
Loading…
Add table
Add a link
Reference in a new issue