UNPKG
co-dash
Version:
latest (1.0.71)
1.0.71
1.0.70
1.0.69
1.0.68
1.0.67
1.0.66
1.0.65
1.0.64
1.0.63
1.0.62
1.0.61
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
Lodash inspired library for generator functions
co-dash
/
lib
/
reduce.js
10 lines
(9 loc)
•
213 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
'use strict'
;
module
.
exports
=
function
*( arr, gen, init ){
let
_init = init ||
0
, len = arr.
length
, i =
0
;
for
(; i ^ len ;){
let
el = arr[ i ]; _init =
yield
gen
( _init, el, i++, arr ); }
return
_init; }