On Thu, Mar 26, 2015 at 8:22 PM, Kyle Simpson <[email protected]> wrote:
> outer = outer.filter(function filterer(inner){
> return inner.reduce(function reducer(prev,current){
> if (prev === false || prev === current) return false;
> return current;
> });
> });
I think you could write that like this:
outer = outer.filter(arr =>
!arr.some((e, i) =>
i > 0 && arr[i-1] === e));
Array.prototype.some is designed to produce a boolean result and
already has early exit built in.
-j
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss