Permalink
Browse files

Add in-place not to README.

[ci skip]
  • Loading branch information...
1 parent c7a3520 commit ff39b0d61f0d4c3af59d706d8f4cba03498ca2c3 @stephank stephank committed Nov 30, 2013
Showing with 8 additions and 2 deletions.
  1. +8 −2 README.md
View
@@ -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.

0 comments on commit ff39b0d

Please sign in to comment.