Re: Array.prototype.includesAll

2016-06-14 Thread Isiah Meadows
I agree that the tone was a bit iffy, but I do support this being in a third party library. I have only a couple times ever had a legitimate need for this, one of which was to write an assertion that I later used. Not sure it's common enough it needs to be in the language. I just don't see the

Re: Array.prototype.includesAll

2016-06-14 Thread Alexander Jones
There is a precedent here from set theory. A.includesAll(B) is really the equivalent of: A is a superset of B or otherwise put: B - A = empty set Hence, if B is the empty set, then it is indeed true for all sets A. Cheers On Tuesday, 14 June 2016, Shahar Or

Re: Array.prototype.includesAll

2016-06-14 Thread Tab Atkins Jr.
On Tue, Jun 14, 2016 at 12:58 PM, Bob Myers wrote: > This proposal is so far from something that should go into the base language > that it makes me choke. > > Are you also going to propose that we add `includesNone` and `includesSome`? > Do you want to include an option to sort the

Re: Array.prototype.includesAll

2016-06-14 Thread Bob Myers
This proposal is so far from something that should go into the base language that it makes me choke. Are you also going to propose that we add `includesNone` and `includesSome`? Do you want to include an option to sort the items for efficiency? Why do you provide no `fromIndex` parameter? Shall

RE: Array.prototype.includesAll

2016-06-14 Thread Oriol Bugzilla
> There are no items in `[]` so that doesn't seem like a true statement to me. It's true by [Vacuous_truth](https://en.wikipedia.org/wiki/Vacuous_truth). > So, at least consistency pulls towards `false`. You are misunderstanding what `includes` does when there is no argument. ```js

Re: Array.prototype.includesAll

2016-06-14 Thread Renki Ivanko
There are no items in [] that aren't included in [2,3]. A separate question is whether undefined should mean []; I'd say it should throw a TypeError instead. On Tue, Jun 14, 2016 at 10:06 PM, Shahar Or wrote: > What's the point of using `reduce` instead of `every`?

Re: Array.prototype.includesAll

2016-06-14 Thread Shahar Or
> > What's the point of using `reduce` instead of `every`? > Of course. Updated to use `.every`. I disagree with this test > > ```js > expect([2, 3].includesAll()).toBe(false) > ``` > > The array `[2,3]` includes all items in `[]`. So it should return `true`. > There are no items in `[]` so

RE: Array.prototype.includesAll

2016-06-14 Thread Oriol Bugzilla
What's the point of using `reduce` instead of `every`? ```js Array.prototype.includesAll = function (...args) { return args.every(item => this.includes(item)); } ``` I disagree with this test ```js expect([2, 3].includesAll()).toBe(false) ``` The array `[2,3]` includes all items in `[]`.

Re: Array.prototype.includesAll

2016-06-14 Thread Jordan Harband
totype-includes-with-multiple-arguments > > How about something like this `Array.prototype.includesAll`? > http://codepen.io/mightyiam/pen/PzNLKr/?editors=0012 > > > ___ > es-discuss mailing list > es-discuss@mozilla.org > ht

Array.prototype.includesAll

2016-06-14 Thread Shahar Or
Hey, following up from: https://esdiscuss.org/topic/array-prototype-includes-with-multiple-arguments How about something like this `Array.prototype.includesAll`? http://codepen.io/mightyiam/pen/PzNLKr/?editors=0012 ___ es-discuss mailing list es-discuss