Package Exports
- sort-on
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sort-on) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
sort-on 
Sort an array on an object property
Install
$ npm install --save sort-on
Usage
var sortOn = require('sort-on');
// sort by an object property
sortOn([{x: 'b'}, {x: 'a'}, {x: 'c'}], 'x');
//=> [{x: 'a'}, {x: 'b'}, {x: 'c'}]
// sort by a nested object property
sortOn([{x: {y: 'b'}}, {x: {y: 'a'}}], 'x.y');
//=> [{x: {y: 'a'}}, {x: {y: 'b'}}]
// sort by the `x` propery, then `y`
sortOn([{x: 'c', y: 'c'}, {x: 'b', y: 'a'}, {x: 'b', y: 'b'}], ['x', 'y']);
//=> [{x: 'b', y: 'a'}, {x: 'b', y: 'b'}, {x: 'c', y: 'c'}]
// sort by the returned value
sortOn([{x: 'b'}, {x: 'a'}, {x: 'c'}], function (el) {
return el.x;
});
//=> [{x: 'a'}, {x: 'b'}, {x: 'c'}]
API
sortOn(array, property)
Returns a new sorted array.
array
Required
Type: array
property
Required
Type: string
, function
or array
of either
The string can be a dot path to a nested object property.
License
MIT © Sindre Sorhus