Michał Wadas michalwadas at
Tue Jul 10 10:01:07 UTC 2018

Personally I would prefer signature Array.prototype.replace(map : Map).

On Tue, Jul 10, 2018 at 5:42 AM, Ben Wiley <therealbenwiley at>

> Hi ECMAScript folks,
> I'm brand new to this process and I've drafted a proposal (and polyfill)
> for a new Array.prototype.replace method. In the vein of Array concat,
> String replace and the new Object rest spread, Array replace provides a way
> to shallow clone an array and replace an element in a single statement.
> Here's the GitHub repo, which outlines API, motivation, use cases,
> alternatives, and polyfill usage:
> benwiley4000/array-replace
> Array replace shouldn't be considered an across-the-board substitute for
> Array.prototype.splice (which mutates the array) and wouldn't be ideal for
> performance critical applications handling very large arrays. It is well
> suited for application logic where immutability is desired - a trend
> growing in the Javascript community.
> Most of the application areas of object rest spread composition syntax
> (for building objects, not destructuring them) are also application areas
> for Array.prototype.replace, when your object happens to be an array.
> I'm looking forward to any feedback and I'd also love for a champion to
> step in and help, if you think this is an ok idea.
> Thanks!
> Ben
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list