I'd like to see this implemented, at least for greater/less than (-or equal
to).

   a < b < c
   a <= b <= c

Desugars to

   a < b && b < c
   a <= b && b <= c

As a workaround, consider that ES6 arrow functions are going to
make something like this readable:

   function sortedBy(op,...args) {
     for(var i=1; i<args.length; i++) {
       if (!op( args[i-1], args[i])) return false;
     }
     return true;
   }

   console.log( sortedBy( (a,b)=>a<b,  2,3,4) );  // true
   console.log( sortedBy( (a,b)=>a<b,  2,4,3) );  // false

   console.log( sortedBy( (a,b)=>a<b,  2,2,3) );  // false
   console.log( sortedBy( (a,b)=>a<=b, 2,2,3) );  // true

Claus

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to