Skip to content

Commit 967e378

Browse files
committed
readme
1 parent bac7f90 commit 967e378

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

README.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Sort an array of primitives, for example strings.
2323
[ 'afternoon', 'evening', 'morning', 'twilight' ]
2424
```
2525

26+
### Custom sort order
27+
2628
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.
2729

2830
```js
@@ -35,6 +37,8 @@ The default sort order is `asc`. You can also specify `desc` or the name of a pr
3537
[ 'morning', 'afternoon', 'evening', 'twilight' ]
3638
```
3739

40+
### Sort by computed field
41+
3842
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`).
3943

4044
```js
@@ -58,6 +62,8 @@ Sort by a computed field, i.e. a computed value that doesn't exist in the input
5862
]
5963
```
6064

65+
### Sort by deep object values
66+
6167
You can use computed fields to sort by values deep in an object structure.
6268

6369
```js
@@ -80,6 +86,8 @@ You can use computed fields to sort by values deep in an object structure.
8086
]
8187
```
8288

89+
### Sort by multiple fields
90+
8391
Sort by multiple columns using multiple custom orders.
8492

8593
```js
@@ -118,6 +126,8 @@ Sort by multiple columns using multiple custom orders.
118126

119127
Please visit [the sort-array wiki](https://github.com/75lb/sort-array/wiki) for more examples.
120128

129+
## API Reference
130+
121131
{{>main}}
122132

123133
## Load anywhere

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Sort an array of primitives, for example strings.
2323
[ 'afternoon', 'evening', 'morning', 'twilight' ]
2424
```
2525

26+
### Custom sort order
27+
2628
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.
2729

2830
```js
@@ -35,6 +37,8 @@ The default sort order is `asc`. You can also specify `desc` or the name of a pr
3537
[ 'morning', 'afternoon', 'evening', 'twilight' ]
3638
```
3739

40+
### Sort by computed field
41+
3842
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`).
3943

4044
```js
@@ -58,6 +62,8 @@ Sort by a computed field, i.e. a computed value that doesn't exist in the input
5862
]
5963
```
6064

65+
### Sort by deep object values
66+
6167
You can use computed fields to sort by values deep in an object structure.
6268

6369
```js
@@ -80,6 +86,8 @@ You can use computed fields to sort by values deep in an object structure.
8086
]
8187
```
8288

89+
### Sort by multiple fields
90+
8391
Sort by multiple columns using multiple custom orders.
8492

8593
```js
@@ -118,9 +126,11 @@ Sort by multiple columns using multiple custom orders.
118126

119127
Please visit [the sort-array wiki](https://github.com/75lb/sort-array/wiki) for more examples.
120128

129+
## API Reference
130+
121131
<a name="module_sort-array"></a>
122132

123-
## sort-array
133+
### sort-array
124134
Isomorphic, load-anywhere function to sort an array by scalar, deep or computed values in any standard or custom order.
125135

126136
**Example**
@@ -129,7 +139,7 @@ const sortArray = require('sort-array')
129139
```
130140
<a name="exp_module_sort-array--sortArray"></a>
131141

132-
### sortArray(array, [options]) ⇒ <code>Array</code> ⏏
142+
#### sortArray(array, [options]) ⇒ <code>Array</code> ⏏
133143
**Kind**: Exported function
134144
**Returns**: <code>Array</code> - Returns the array that was passed in.
135145

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"scripts": {
2727
"test": "npm run dist && test-runner test/*.js",
28-
"docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md",
28+
"docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs -d 3 > README.md",
2929
"dist": "rollup -c"
3030
},
3131
"dependencies": {

0 commit comments

Comments
 (0)