Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make metasync.map compatible with Array.map #325

Open
tshemsedinov opened this issue Apr 5, 2018 · 2 comments
Open

Make metasync.map compatible with Array.map #325

tshemsedinov opened this issue Apr 5, 2018 · 2 comments
Assignees

Comments

@tshemsedinov
Copy link
Member

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 tshemsedinov changed the title Make metasync.map contract compatible with Array.map Make metasync.map compatible with Array.map Apr 6, 2018
@o-rumiantsev o-rumiantsev self-assigned this Oct 8, 2018
@o-rumiantsev
Copy link
Member

@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);

@nechaido
Copy link
Member

nechaido commented Oct 8, 2018

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants