Re: Re: Array.prototype.toObjectByProperty( element=>element.property )

2017-08-12 Thread Barret Furton
Why not embrace `Array.prototype.reduce` instead of trying to abstract it away? ```js const identity = a => a const toObject = (fk, fv = identity) => (acc, curr) => (acc[fk(curr)] = fv(curr), acc) const arr = [['a', '1'], ['b', '2'], ['c', '3']] arr.map(a => [a[0], parseInt(a[1], 10)]) .

Re: Small Proposal "!in"

2018-07-11 Thread Barret Furton
Mixing the semantics of a unary operator with a binary operator seems... not ideal. On Tue, Jul 10, 2018 at 7:23 AM kai zhu wrote: > -1 > > this feature mostly cross-cuts "!obj.hasOwnProperty('foo')". the only > semantic-difference is "in" will check prototype-chain as jordan > pointed out (and

Re: Small Proposal "!in"

2018-07-11 Thread Barret Furton
Good point. On Wed, Jul 11, 2018 at 10:02 AM Guylian Cox wrote: > It isn't that different from mixing == with ! to get != > > Le mer. 11 juil. 2018 à 15:51, Barret Furton a > écrit : > >> Mixing the semantics of a unary operator with a binary operator seems... >&

Re: Re: Proposal: Selector/Select Expression

2019-06-22 Thread Barret Furton
I wonder if this could be accomplished with a proxy object instead of new syntax. ```js const o = new Proxy(/* some implementation */); const pickName = o.name; pickName({ name: "Bob" }); // "Bob" // maybe this could work too with a recursive proxy // with handlers for access and invocation con