UNPKG
imma
Version:
latest (0.0.1)
0.0.1
A collection of functions for dealing with native arrays and objects immutably
imma
/
lib
/
general
/
reduce.js
8 lines
(6 loc)
•
232 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
'use strict'
const
objectReduce =
require
(
'../object/reduce'
)
const
reduce =
module
.
exports
=
(
iterable, fn, initial
) =>
Array
.
isArray
(iterable) ? iterable.
reduce
(fn, initial) :
objectReduce
(iterable, fn, initial)