Skip to content

Commit 055c178

Browse files
Merge pull request #13 from mesqueeb/patch-1
better readability
2 parents a7913f8 + 0adaf54 commit 055c178

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.verb.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ Sort an array by the given object property:
44

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

8-
arraySort([{foo: 'y'}, {foo: 'z'}, {foo: 'x'}], 'foo');
10+
var arr = [{foo: 'y'}, {foo: 'z'}, {foo: 'x'}];
11+
arraySort(arr, 'foo');
912
//=> [{foo: 'x'}, {foo: 'y'}, {foo: 'z'}]
1013
```
1114

1215
**Reverse order**
1316

1417
```js
15-
arraySort([{foo: 'y'}, {foo: 'z'}, {foo: 'x'}], 'foo', {reverse: true});
18+
var arr = [{foo: 'y'}, {foo: 'z'}, {foo: 'x'}];
19+
arraySort(arr, 'foo', {reverse: true});
1620
//=> [{foo: 'z'}, {foo: 'y'}, {foo: 'x'}]
1721
```
1822

0 commit comments

Comments
 (0)