Short Comparing proposal
rtm at gol.com
Fri Feb 3 20:29:06 UTC 2017
If you're worried about short-circuiting, then
[() => a, () => b].some(x => c === x())
On Sat, Feb 4, 2017 at 12:29 AM, T.J. Crowder <tj.crowder at farsightsoftware.
> On Fri, Feb 3, 2017 at 6:51 PM, Bob Myers <rtm at gol.com> wrote:
>> I'm puzzled about what's wrong with the good old `[a, b].some(x => x ===
>> object.property.secondProp)`. If you insist on sugarizing this (but why?),
>> then it could be `[a, b].some(=== object.property.secondProp)`, or even
>> `[a, b].||(=== object.property.secondProp)`. But again, why?
> Well, or as the originator of the thread pointed out, `[a, b].includes(
> As I pointed out earlier in the thread, I think the only real
> justification for syntax for this would be short-circuiting (lazy
> evaluation of the possible values to be matched against). For my part, I'm
> not at all sure it's a sufficient one for new syntax.
> -- T.J.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss