Package Exports
- sort-nested-json
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-nested-json) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
sort-nested-json
You can use sort-nested-json to sort an json array.
Install
npm install --save sort-nested-jsonUsage
Usage
Here is an example of using sort-nested-json.
import sorter from 'sort-nested-json';
let array = [{
id: 1,
firstname: "John",
lastname: "Smith"
},
{
id: 2,
firstname: "Jane",
lastname: "Wilson"
},
{
id: 3,
firstname: "Peter",
lastname: "Brown"
}]
array = sorter.sort(array).desc("firsname")
console.log(array)
array = sorter.sort(array).asc("firsname")
console.log(array)