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.
 
 
 
 

15 lines
405 B

import each from './each';
import isArray from './is-array';
import isPlainObject from './is-plain-object';
var reduce = function (arr, fn, init) {
if (!isArray(arr) && !isPlainObject(arr)) {
return arr;
}
var result = init;
each(arr, function (data, i) {
result = fn(result, data, i);
});
return result;
};
export default reduce;
//# sourceMappingURL=reduce.js.map