Skip to content

Commit 29e85f6

Browse files
committed
update readme and deps
1 parent 516a08c commit 29e85f6

4 files changed

Lines changed: 96 additions & 43 deletions

File tree

README.hbs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ const sortArray = require('sort-array')
1414

1515
## Synopsis
1616

17-
Sort an array of primitives, for example strings.
17+
Some trivial examples to demonstrate typical usage.
18+
19+
### Sorting an array of primitives
20+
21+
Sort an array of strings.
1822

1923
```js
2024
> const partsOfTheDay = ['twilight', 'afternoon', 'morning', 'evening']
@@ -23,7 +27,7 @@ Sort an array of primitives, for example strings.
2327
[ 'afternoon', 'evening', 'morning', 'twilight' ]
2428
```
2529

26-
### Custom sort order
30+
#### Custom sort order
2731

2832
The default sort order is `asc`. You can also specify `desc` or the name of a property from the `customOrders` object. For example, sort parts of the day by the order in which they occur.
2933

@@ -37,7 +41,9 @@ The default sort order is `asc`. You can also specify `desc` or the name of a pr
3741
[ 'morning', 'afternoon', 'evening', 'twilight' ]
3842
```
3943

40-
### Sort by computed field
44+
### Sorting an array of objects
45+
46+
#### Sort by computed field
4147

4248
Sort by a computed field, i.e. a computed value that doesn't exist in the input dataset. Define your computed fields in the `options.computed` object, each value being a function which takes an array member as input and returns the primitive value to be sorted by. In this example we sort by `total` (the name of the computed field supplied in `options.computed`).
4349

@@ -62,7 +68,7 @@ Sort by a computed field, i.e. a computed value that doesn't exist in the input
6268
]
6369
```
6470

65-
### Sort by deep object values
71+
#### Sort by deep object values
6672

6773
You can use computed fields to sort by values deep in an object structure.
6874

@@ -86,7 +92,7 @@ You can use computed fields to sort by values deep in an object structure.
8692
]
8793
```
8894

89-
### Sort by multiple fields
95+
#### Sort by multiple fields
9096

9197
Sort by multiple columns using multiple custom orders.
9298

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ const sortArray = require('sort-array')
1414

1515
## Synopsis
1616

17-
Sort an array of primitives, for example strings.
17+
Some trivial examples to demonstrate typical usage.
18+
19+
### Sorting an array of primitives
20+
21+
Sort an array of strings.
1822

1923
```js
2024
> const partsOfTheDay = ['twilight', 'afternoon', 'morning', 'evening']
@@ -23,7 +27,7 @@ Sort an array of primitives, for example strings.
2327
[ 'afternoon', 'evening', 'morning', 'twilight' ]
2428
```
2529

26-
### Custom sort order
30+
#### Custom sort order
2731

2832
The default sort order is `asc`. You can also specify `desc` or the name of a property from the `customOrders` object. For example, sort parts of the day by the order in which they occur.
2933

@@ -37,7 +41,9 @@ The default sort order is `asc`. You can also specify `desc` or the name of a pr
3741
[ 'morning', 'afternoon', 'evening', 'twilight' ]
3842
```
3943

40-
### Sort by computed field
44+
### Sorting an array of objects
45+
46+
#### Sort by computed field
4147

4248
Sort by a computed field, i.e. a computed value that doesn't exist in the input dataset. Define your computed fields in the `options.computed` object, each value being a function which takes an array member as input and returns the primitive value to be sorted by. In this example we sort by `total` (the name of the computed field supplied in `options.computed`).
4349

@@ -62,7 +68,7 @@ Sort by a computed field, i.e. a computed value that doesn't exist in the input
6268
]
6369
```
6470

65-
### Sort by deep object values
71+
#### Sort by deep object values
6672

6773
You can use computed fields to sort by values deep in an object structure.
6874

@@ -86,7 +92,7 @@ You can use computed fields to sort by values deep in an object structure.
8692
]
8793
```
8894

89-
### Sort by multiple fields
95+
#### Sort by multiple fields
9096

9197
Sort by multiple columns using multiple custom orders.
9298

@@ -133,15 +139,15 @@ Please visit [the sort-array wiki](https://github.com/75lb/sort-array/wiki) for
133139
### sort-array
134140
Isomorphic, load-anywhere function to sort an array by scalar, deep or computed values in any standard or custom order.
135141

136-
**Example**
142+
**Example**
137143
```js
138144
const sortArray = require('sort-array')
139145
```
140146
<a name="exp_module_sort-array--sortArray"></a>
141147

142148
#### sortArray(array, [options]) ⇒ <code>Array</code> ⏏
143-
**Kind**: Exported function
144-
**Returns**: <code>Array</code> - Returns the array that was passed in.
149+
**Kind**: Exported function
150+
**Returns**: <code>Array</code> - Returns the array that was passed in.
145151

146152
| Param | Type | Description |
147153
| --- | --- | --- |

package-lock.json

Lines changed: 66 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"node": ">=10"
2525
},
2626
"scripts": {
27-
"test": "npm run dist && esm-runner test/*.mjs && web-runner test/*.mjs",
27+
"test": "npm run dist && npm run test:esm && web-runner test/*.mjs",
28+
"test:esm": "esm-runner test/*.mjs --view.hide-skips",
2829
"docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs -d 3 > README.md",
2930
"dist": "rollup -c"
3031
},
@@ -34,12 +35,12 @@
3435
},
3536
"devDependencies": {
3637
"@test-runner/web": "^0.3.3",
37-
"esm-runner": "^0.3.3",
38+
"esm-runner": "^0.3.4",
3839
"isomorphic-assert": "^0.1.1",
3940
"jsdoc-to-markdown": "^5.0.3",
40-
"rollup": "^1.27.9",
41+
"rollup": "^1.27.10",
4142
"rollup-plugin-node-resolve": "^5.2.0",
42-
"test-object-model": "^0.6.0"
43+
"test-object-model": "^0.6.1"
4344
},
4445
"files": [
4546
"dist/index.js",

0 commit comments

Comments
 (0)