{"name":"sort-object-keys","version":"1.0.0","description":"Sort an object's keys, including an optional key list","main":"index.js","scripts":{"test":"test.js"},"repository":{"type":"git","url":"git+ssh://git@github.com/keithamus/sort-object-keys.git"},"keywords":["object","sort","keys"],"author":{"name":"Keith Cirkel","email":"npm@keithcirkel.co.uk","url":"http://keithcirkel.co.uk/"},"license":"MIT","bugs":{"url":"https://github.com/keithamus/sort-object-keys/issues"},"homepage":"https://github.com/keithamus/sort-object-keys#readme","gitHead":"f87e818260e54d279fefa664e4f2d9224a4e1761","_id":"sort-object-keys@1.0.0","_shasum":"53a180c28f986900b698a729c5856a9d800de3a5","_from":".","_npmVersion":"3.4.0","_nodeVersion":"4.2.2","_npmUser":{"name":"keithamus","email":"npm@keithcirkel.co.uk"},"dist":{"shasum":"53a180c28f986900b698a729c5856a9d800de3a5","tarball":"http://registry-npm.ywwl.com/sort-object-keys/download/sort-object-keys-1.0.0.tgz","integrity":"sha512-GoGiYNtv6gaMoscDonVBmNKGtyBlt8C93aAG3aTBdcZjLsyoMYuibKBkk0ePgFig4IN1b5Ga9r/pr8bVtfWrUg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCRtXeFAOpA1ILrBifF7m6rWWBoeOHByJjEIiX+DIlbhAIgIbtOToWTNa1/NlKrPA/dYSqqlmzbRIN6OEq3w0EVfOU="}],"size":868,"noattachment":false,"key":"/sort-object-keys/-/sort-object-keys-1.0.0.tgz"},"maintainers":[{"name":"keithamus","email":"npm@keithcirkel.co.uk"}],"directories":{},"readme":"# Sort Object\n\n\n\n[![Build Status](https://travis-ci.org/keithamus/sort-object-keys.svg)](https://travis-ci.org/keithamus/sort-object-keys)\n\nReturns a copy of an object with all keys sorted.\n\nThe second argument is optional and is used for ordering - to provide custom sorts. You can either pass an array containing ordered keys or a function to sort the keys (same signature as in [`Array.prototype.sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)).\n\n```js\nconst assert = require('assert');\nconst sortObject = require('sort-object-keys');\n\nassert.equal(JSON.stringify({\n  c: 1,\n  b: 1,\n  d: 1,\n  a: 1,\n}), JSON.stringify({\n  a: 1,\n  b: 1,\n  c: 1,\n  d: 1,\n}));\n\nassert.equal(JSON.stringify(sortObject({\n  c: 1,\n  b: 1,\n  d: 1,\n  a: 1,\n}, ['b', 'a', 'd', 'c'])), JSON.stringify({\n  b: 1,\n  a: 1,\n  d: 1,\n  c: 1,\n}));\n\nfunction removeKeyAncCompareIndex(keyA, keyB){\n  var a = parseInt(keyA.slice(4));\n  var b = parseInt(keyB.slice(4));\n  return a - b;\n}\n\nassert.equal(JSON.stringify(sortObject({\n  \"key-1\": 1,\n  \"key-3\": 1,\n  \"key-10\": 1,\n  \"key-2\": 1,\n}, removeKeyAncCompareIndex)), JSON.stringify({\n  \"key-1\": 1,\n  \"key-2\": 1,\n  \"key-3\": 1,\n  \"key-10\": 1,\n}));\n```\n","publish_time":1448915398033,"_cnpm_publish_time":1448915398033,"dist-tags":{"latest":"2.1.0"}}