Skip to content

Commit

Permalink
Merge pull request #13 from mesqueeb/patch-1
Browse files Browse the repository at this point in the history
better readability
  • Loading branch information
jonschlinkert authored Mar 11, 2018
2 parents a7913f8 + 0adaf54 commit 055c178
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .verb.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ Sort an array by the given object property:

```js
var arraySort = require('{%= name %}');
// or for ES6 imports:
import arraySort from 'array-sort'

arraySort([{foo: 'y'}, {foo: 'z'}, {foo: 'x'}], 'foo');
var arr = [{foo: 'y'}, {foo: 'z'}, {foo: 'x'}];
arraySort(arr, 'foo');
//=> [{foo: 'x'}, {foo: 'y'}, {foo: 'z'}]
```

**Reverse order**

```js
arraySort([{foo: 'y'}, {foo: 'z'}, {foo: 'x'}], 'foo', {reverse: true});
var arr = [{foo: 'y'}, {foo: 'z'}, {foo: 'x'}];
arraySort(arr, 'foo', {reverse: true});
//=> [{foo: 'z'}, {foo: 'y'}, {foo: 'x'}]
```

Expand Down

0 comments on commit 055c178

Please sign in to comment.