Personally I would prefer signature Array.prototype.replace(map : Map). https://gist.github.com/Ginden/bf628e88be0886ac8340bdecf16e98f3
On Tue, Jul 10, 2018 at 5:42 AM, Ben Wiley <[email protected]> wrote: > 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: https://github.com/ > 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 > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

