Sort object keys by length
$ npm install --save sort-keys-length
var 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' }
Ascending sort.
Descending sort.
MIT © Kevin Mårtensson
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.