deep-sort-object

1.0.2 • Public • Published

deep-sort-object

NPM version Downloads Build Status Dependency status Dev Dependency status

Simple module to sort objects recursively by its keys.

Installation

$ npm install deep-sort-object - NPM
$ bower install deep-sort-object - bower

The browser file is named index.umd.js which supports CommonJS, AMD and globals (deepForEach). If you want to run this module on old browsers, you must include es5-shim.

Usage

The example bellow is based on nodejs.

var sortobject = require('deep-sort-object');
 
sortobject({
    'z': 'foo',
    'b': 'bar',
    'a': [
        {
            'z': 'foo',
            'b': 'bar'
        }
    ]
});
 
/*
{
    'a': [
        {
            'b': 'bar',
            'z': 'foo'
        }
    ],
    'b': 'bar',
    'z': 'foo'
});
*/

Tests

$ npm test

License

Released under the MIT License.

Package Sidebar

Install

npm i deep-sort-object

Weekly Downloads

61,293

Version

1.0.2

License

MIT

Last publish

Collaborators

  • satazor