Since `Array.prototype.push` is variadic, I don't see how this would be any
improvement on the status quo (which isn't that bad to begin with).
On Wed, May 23, 2018, 13:57 T.J. Crowder
wrote:
> On Wed, May 23, 2018 at 6:49 PM, Jordi Bunster
Just one thought ...
```js
Object.defineProperty(Array.prototype, "append", {
value(...sources) {
this.push(...[...sources]);
return this;
},
writable: true,
configurable: true
});
```
... but also another one ...
```js
(array.push(...sources), array)
```
it seems
On Wed, May 23, 2018 at 1:05 PM, Jordan Harband wrote:
> `array.push(...sources)`, not sure why we'd need "append".
>From the original email (a bit buried and hard to find due to broken
threading, admittedly):
> Has anyone ever suggested Array.prototype.append as an
`array.push(...sources)`, not sure why we'd need "append".
On Wed, May 23, 2018 at 1:25 PM, T.J. Crowder <
tj.crow...@farsightsoftware.com> wrote:
> On Wed, May 23, 2018 at 5:56 PM, Alexander Lichter wrote:
> > An optimization would be great because in comparison to the
On Wed, May 23, 2018 at 6:49 PM, Jordi Bunster
wrote:
> Cool!
>
> So for me, the point would be symmetry with Map and Set.
Are you saying you'd want to have `append` on them as well?
> As such my poly would go like so:
>
> ```js
> Object.defineProperty(Array.prototype,
Cool!
So for me, the point would be symmetry with Map and Set.
As such my poly would go like so:
```js
Object.defineProperty(Array.prototype, "append", {
writable: true,
configurable: true,
value: function(arg) {
this.push(arg);
return this;
}
});
```
(Which is
On Wed, May 23, 2018 at 5:56 PM, Alexander Lichter wrote:
> An optimization would be great because in comparison to the existing
concat
> method, rest/spread is significantly slower at the moment (see
> https://jsperf.com/single-array-composition)
There's a limit to how much
An optimization would be great because in comparison to the existing
concat method, rest/spread is significantly slower at the moment (see
https://jsperf.com/single-array-composition)
On 23.05.2018 18:34, Ben Fletcher wrote:
Does the `[...oldArr, ...elementsToPushArr]` pattern take care of
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
On Wed, May 23, 2018 at 1:29 PM, Isiah Meadows
wrote:
> That's the usual means of specifying precedence in anything remotely
> like BNF. ;-)
>
> (IIUC It *could* be duplicated in *PrimaryExpression*, but it'd just
> get unruly real quick if you were to try to expand
That's the usual means of specifying precedence in anything remotely
like BNF. ;-)
(IIUC It *could* be duplicated in *PrimaryExpression*, but it'd just
get unruly real quick if you were to try to expand everything.)
-
Isiah Meadows
m...@isiahmeadows.com
www.isiahmeadows.com
On Tue, May
11 matches
Mail list logo