metarhia / metasync

Asynchronous Programming Library for JavaScript & Node.js
https://metarhia.com
MIT License
206 stars 35 forks source link

Make metasync.reduce compatible with Array.reduce #328

Open tshemsedinov opened 6 years ago

tshemsedinov commented 6 years ago

Compare

Array.prototype.reduce((previous, current, index, array) => (result) [, initial]) : Array

and current implementation:

metasync.reduce(
  array,
  (previous, current, callback, index, array) => callback(result)
  [, initial]
);

we may change to:

metasync.reduce(
  array,
  (previous, current, [index, [array],] callback) => callback(result)
  [, initial]
);