sortkeys

Sort the keys of an object recursively

npm install sortkeys
4 downloads in the last week
8 downloads in the last month

sortkeys

This function returns a copy of an object whose keys are sorted by the default method of Array.sort().

An example should explain it:


var sortkeys = require('sortkeys');

var objToSort = {
  d : "is for dog"
  , c : "is for cat"
  , f : "is for fig"
  , a : "is for ant"
};

console.log(sortkeys(objToSort));

/*
{ a: 'is for ant',
  c: 'is for cat',
  d: 'is for dog',
  f: 'is for fig' }
*/
npm loves you