You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -23,7 +27,7 @@ Sort an array of primitives, for example strings.
23
27
[ 'afternoon', 'evening', 'morning', 'twilight' ]
24
28
```
25
29
26
-
### Custom sort order
30
+
#### Custom sort order
27
31
28
32
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.
29
33
@@ -37,7 +41,9 @@ The default sort order is `asc`. You can also specify `desc` or the name of a pr
37
41
[ 'morning', 'afternoon', 'evening', 'twilight' ]
38
42
```
39
43
40
-
### Sort by computed field
44
+
### Sorting an array of objects
45
+
46
+
#### Sort by computed field
41
47
42
48
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`).
43
49
@@ -62,7 +68,7 @@ Sort by a computed field, i.e. a computed value that doesn't exist in the input
62
68
]
63
69
```
64
70
65
-
### Sort by deep object values
71
+
#### Sort by deep object values
66
72
67
73
You can use computed fields to sort by values deep in an object structure.
68
74
@@ -86,7 +92,7 @@ You can use computed fields to sort by values deep in an object structure.
86
92
]
87
93
```
88
94
89
-
### Sort by multiple fields
95
+
#### Sort by multiple fields
90
96
91
97
Sort by multiple columns using multiple custom orders.
@@ -23,7 +27,7 @@ Sort an array of primitives, for example strings.
23
27
[ 'afternoon', 'evening', 'morning', 'twilight' ]
24
28
```
25
29
26
-
### Custom sort order
30
+
####Custom sort order
27
31
28
32
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.
29
33
@@ -37,7 +41,9 @@ The default sort order is `asc`. You can also specify `desc` or the name of a pr
37
41
[ 'morning', 'afternoon', 'evening', 'twilight' ]
38
42
```
39
43
40
-
### Sort by computed field
44
+
### Sorting an array of objects
45
+
46
+
#### Sort by computed field
41
47
42
48
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`).
43
49
@@ -62,7 +68,7 @@ Sort by a computed field, i.e. a computed value that doesn't exist in the input
62
68
]
63
69
```
64
70
65
-
### Sort by deep object values
71
+
####Sort by deep object values
66
72
67
73
You can use computed fields to sort by values deep in an object structure.
68
74
@@ -86,7 +92,7 @@ You can use computed fields to sort by values deep in an object structure.
86
92
]
87
93
```
88
94
89
-
### Sort by multiple fields
95
+
####Sort by multiple fields
90
96
91
97
Sort by multiple columns using multiple custom orders.
92
98
@@ -133,15 +139,15 @@ Please visit [the sort-array wiki](https://github.com/75lb/sort-array/wiki) for
133
139
### sort-array
134
140
Isomorphic, load-anywhere function to sort an array by scalar, deep or computed values in any standard or custom order.
0 commit comments