Naveen Chawla (2017-07-06T12:44:12.000Z)
In that case, there should be a new function:

"forEvery" (or "forEachAndReturn" or "each" or whatever)

that does exactly the same as "forEach" but returns the array.

This is a much needed feature for those of us that don't want to create a
new array on each invocation but still have the ability to transform the
contents of the array (or do some other processing) from within a .sort /
.map / .filter etc. chain.

Otherwise, in complicated transformations, we have to end the chain,
perform the forEach separately, and then resume the chain, making the code
more messy. Sort is an example of a function that already allows mutation
of the existing array and returns it, so this would be nothing
extraordinary for ES.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170706/74f4d407/attachment.html>
naveen.chwl at gmail.com (2017-07-06T15:06:03.467Z)
In that case, there should be a new function:

e.g. "forEvery"

that does exactly the same as "forEach" but returns the array.

This is a much needed feature for those of us that don't want to create a
new array on each invocation but still have the ability to transform the
contents of the array (or do some other processing) from within a .sort /
.map / .filter etc. chain.

Otherwise, in complicated transformations, we have to end the chain,
perform the forEach separately, and then resume the chain, making the code
more messy. Sort is an example of a function that already allows mutation
of the existing array and returns it, so this would be nothing
extraordinary for ES.