sort-keys-length
v2.0.0
Published
Sort objecy keys by length
Downloads
13,405,874
Readme
sort-keys-length
Sort object keys by length
Install
$ npm install sort-keys-length
Usage
const sortKeysLength = require('sort-keys-length');
sortKeysLength.asc({ab: 'x', a: 'y', abc: 'z'});
//=> {a: 'y', ab: 'x', abc: 'z'}
sortKeysLength.desc({ab: 'x', a: 'y', abc: 'z'});
//=> {abc: 'z', ab: 'x', a: 'y'}
API
sortKeysLength.asc(object, [options])
Ascending sort.
sortKeysLength.desc(object, [options])
Descending sort.
object
Type: Object
Object to sort.
options
Type: Object
deep
Type: boolean
Default: false
Recursively sort keys.
License
MIT © Kevin Mårtensson