Re: es-discuss Digest, Vol 135, Issue 48

2018-05-23 Thread Ben Fletcher
Does the `[...oldArr, ...elementsToPushArr]` pattern take care of that for you? I've always assumed it's much less performant than your form would be, but I (naively) suppose the implementation could be optimized like anything else On Wed, May 23, 2018 at 8:01 AM

Adding .map() directly to String prototype

2018-05-17 Thread Ben Fletcher
Consider adding the array .map() implementation directly to the String prototype. Here is a possible polyfill: String.prototype.map = function (fn) { return Array.prototype.map .call(this, fn) .join(''); } This replaces the common pattern of splitting, mapping,