sort-array
Advanced tools
Comparing version 3.0.5 to 4.0.0
@@ -65,3 +65,3 @@ (function (global, factory) { | ||
return [ input ] | ||
return [input] | ||
} | ||
@@ -68,0 +68,0 @@ |
@@ -7,3 +7,3 @@ { | ||
], | ||
"version": "3.0.5", | ||
"version": "4.0.0", | ||
"description": "Isomorphic, load-anywhere function to sort an array by scalar, deep or computed values in any standard or custom order", | ||
@@ -25,17 +25,18 @@ "repository": "https://github.com/75lb/sort-array", | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=10" | ||
}, | ||
"scripts": { | ||
"test": "npm run dist && test-runner test/*.js", | ||
"docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md", | ||
"dist": "rollup -f umd -o dist/index.js -n sortArray index.mjs && rollup -f esm -o dist/index.mjs index.mjs" | ||
"docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs -d 3 > README.md", | ||
"dist": "rollup -c" | ||
}, | ||
"dependencies": { | ||
"array-back": "^4.0.0", | ||
"typical": "^5.2.0" | ||
"array-back": "^4.0.1", | ||
"typical": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"jsdoc-to-markdown": "^5.0.2", | ||
"rollup": "^1.26.3", | ||
"test-runner": "^0.6.0" | ||
"jsdoc-to-markdown": "^5.0.3", | ||
"rollup": "^1.27.8", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"test-runner": "^0.8.7" | ||
}, | ||
@@ -42,0 +43,0 @@ "files": [ |
@@ -26,2 +26,4 @@ [![view on npm](http://img.shields.io/npm/v/sort-array.svg)](https://www.npmjs.org/package/sort-array) | ||
### Custom sort order | ||
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. | ||
@@ -39,2 +41,4 @@ | ||
### Sort by computed field | ||
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`). | ||
@@ -63,2 +67,4 @@ | ||
### Sort by deep object values | ||
You can use computed fields to sort by values deep in an object structure. | ||
@@ -86,2 +92,4 @@ | ||
### Sort by multiple fields | ||
Sort by multiple columns using multiple custom orders. | ||
@@ -125,5 +133,7 @@ | ||
## API Reference | ||
<a name="module_sort-array"></a> | ||
## sort-array | ||
### sort-array | ||
Isomorphic, load-anywhere function to sort an array by scalar, deep or computed values in any standard or custom order. | ||
@@ -137,3 +147,3 @@ | ||
### sortArray(array, [options]) ⇒ <code>Array</code> ⏏ | ||
#### sortArray(array, [options]) ⇒ <code>Array</code> ⏏ | ||
**Kind**: Exported function | ||
@@ -182,2 +192,4 @@ **Returns**: <code>Array</code> - Returns the array that was passed in. | ||
© 2015-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). | ||
© 2015-20 Lloyd Brookes \<75pound@gmail.com\>. | ||
Tested by [test-runner](https://github.com/test-runner-js/test-runner). Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown). |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38388
189
4
+ Addedtypical@6.0.1(transitive)
- Removedtypical@5.2.0(transitive)
Updatedarray-back@^4.0.1
Updatedtypical@^6.0.0