metasync
metasync copied to clipboard
Make metasync.map compatible with Array.map
Compare
Array.prototype.map((value, index, array) => (result) [, thisArg]) : Array
and current implementation:
metasync.map(array, (value, callback) => callback(result) [, thisArg]);
we may change to:
metasync.map(array, (value, [index], [array], callback) => callback(result));
@tshemsedinov current implementation of metasync.map
has such contract:
metasync.map(array, (value, callback) => callback(err, result), done);
As I understand we should change it to:
metasync.map(array, (value, [index[, array]], callback) => callback(err, result), done);
Or we may also add optional thisArg
to contract, so this will look like this:
metasync.map(array, (value, [index[, array]], callback) => callback(err, result) [, thisArg], done);
@tshemsedinov I'd prefer to leave it as it is, but we should use Iterators instead of Arrays, so that any Iterable object may be passed to metasync.map
and other functions (#313).
On the other hand, we can create metasync.Iterator
for such use-cases.
WDYT?