Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add in-place not to README.

[ci skip]
  • Loading branch information...
commit ff39b0d61f0d4c3af59d706d8f4cba03498ca2c3 1 parent c7a3520
@stephank stephank authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 README.md
View
10 README.md
@@ -28,12 +28,18 @@ Require in your code:
#### Usage
-The default sort is, as with `Array#sort`, lexicographical.
-Unlike `Array#sort`, sorting is **NOT** performed in-place.
+The default sort is, as with `Array#sort`, lexicographical:
stable(["foo", "bar", "baz"]); // => ["bar", "baz", "foo"]
stable([10, 1, 5]); // => [1, 10, 5]
+Unlike `Array#sort`, the default sort is **NOT** in-place. To do an in-place
+sort, use `stable.inplace`, which otherwise works the same:
+
+ var arr = [10, 1, 5];
+ stable(arr) === arr; // => false
+ stable.inplace(arr) === arr; // => true
+
A comparator function can be specified:
// Regular sort() compatible comparator, that returns a number.
Please sign in to comment.
Something went wrong with that request. Please try again.