Just some nitpicking from an API point of view:

`Array.prototype.sort(compareFn, isStable = false)`

should probably be something like:

`Array.prototype.sort(compareFn, options = {})`

(Because who knows what extensions will be proposed in the future.)


Am 10.03.2016 um 18:59 schrieb 森建:
EcmaScript hasn't have the stable sort method yet.
http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.sort

Sure, we can create stable sort function by using `Array#sort`,
by returning the number of index (e.g. `arr.indexOf(arguments[0]) - 
arr.indexOf(arguments[1])`)
when it is equal to both arguments value in `comparefn`.
But this is inefficient and perplexing.

So, I propose below.

`Array#stableSort(comparefn)`

or

`Array#sort(comparefn, isStable = false)`


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

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

Reply via email to