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

Transform and Reduce argument order #1043

Closed
megawac opened this issue Mar 1, 2016 · 6 comments
Closed

Transform and Reduce argument order #1043

megawac opened this issue Mar 1, 2016 · 6 comments

Comments

@megawac
Copy link
Collaborator

megawac commented Mar 1, 2016

See #892 for context

I am for async.reduce(arr, iteratee, [accumulator,] callback)

/cc @aearly @qsona @suguru03

@qsona
Copy link

qsona commented Mar 2, 2016

I'm +1 for async.reduce(arr, iteratee, [accumulator,] callback). 💯

@suguru03
Copy link
Contributor

suguru03 commented Mar 2, 2016

+1
I agree. Thank you for notification!

@megawac
Copy link
Collaborator Author

megawac commented Mar 4, 2016

I'm having second thoughts as I started writing test cases.

It's more logical I think to write

var arr = [....]

async.transform(arr, {}, function(memo, v, k) {
   memo[k] = v;
    cb();
}, function() {
    ....
}

then

var arr = [....]

async.transform(arr, function(memo, v, k) {
   memo[k] = v;
    cb();
}, {}, function() {
    ....
}

@aearly
Copy link
Collaborator

aearly commented Mar 5, 2016

Yeah, the way it is now is easier to parse visually when you have an inline iteratee. I'm not sure what we should do here.

@megawac
Copy link
Collaborator Author

megawac commented Mar 5, 2016

I think we should err on the side of no breaking changes honestly

@aearly
Copy link
Collaborator

aearly commented Mar 6, 2016

Ok, then maybe we should keep the args ordering for transform and reduce as-is.

@aearly aearly closed this as completed Mar 10, 2016
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

4 participants