Package Exports
- obj-sort
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 (obj-sort) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
obj-sort 
Order object by ascending or descending
Install
$ npm install --save obj-sort
Usage
const objSort = require('obj-sort');
// ascending by default
objSort({
b: 'b',
c: ['y', 'x'],
a: {y: 'x', x: 'y', n: {foo: 'foo', bar: 'bar'}}
});
/*
{
a: {n: {bar: 'bar', foo: 'foo'}, x: 'y', y: 'x'},
b: 'b',
c: ['y', 'x']
}
*/
// descending
objSort({
a: {n: {bar: 'bar', foo: 'foo'}, x: 'y'},
c: ['y', 'x'],
b: 'b'
}, 'desc');
/*
{
c: ['y', 'x'],
b: 'b',
a: {x: 'y', n: {foo: 'foo', bar: 'bar'}}
}
*/
API
objSort(obj, order)
Returns an object
obj
Type: object
order
Type: string
Options: asc
, desc
Default: asc
Set order type object
License
MIT © Guntur Poetra