{"name":"sort-object-keys","version":"2.0.0","keywords":["keys","object","sort"],"author":{"url":"http://keithcirkel.co.uk/","name":"Keith Cirkel","email":"npm@keithcirkel.co.uk"},"license":"MIT","_id":"sort-object-keys@2.0.0","maintainers":[{"name":"keithamus","email":"npm@keithcirkel.co.uk"}],"homepage":"https://github.com/keithamus/sort-object-keys#readme","bugs":{"url":"https://github.com/keithamus/sort-object-keys/issues"},"dist":{"shasum":"e5dc3d75d07d4efe73ba6ac55f2f1a4380fdedf8","tarball":"http://registry-npm.ywwl.com/sort-object-keys/download/sort-object-keys-2.0.0.tgz","fileCount":4,"integrity":"sha512-FTUWjmUumK0IGXn1INzkS3lS2Fqw81JuomcExd7LsFvQnNl+9+IZ575fC21F/AwrR/6lMrH7lTX0e7qLBk1wMg==","signatures":[{"sig":"MEUCIE7VqsSXdPfVjE0XofaAX2yFLbAoanj2liEpdmRGPuWCAiEA+xy/7HUibQhvE2FPBkxNcZK1PmY7PHSxRK0chYT3pDE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3112,"size":1470,"noattachment":false,"key":"/sort-object-keys/-/sort-object-keys-2.0.0.tgz"},"main":"index.js","type":"module","types":"index.d.ts","exports":{".":{"import":{"types":"./index.d.ts","default":"./index.js"}}},"gitHead":"1531dbde925c5c83408bdaaa8ecd0804276f4208","scripts":{"sort":"sort-package-json","test":"node test.js"},"_npmUser":{"name":"keithamus","email":"npm@keithcirkel.co.uk"},"repository":{"url":"git+ssh://git@github.com/keithamus/sort-object-keys.git","type":"git"},"_npmVersion":"11.6.0","description":"Sort an object's keys, including an optional key list","directories":{},"_nodeVersion":"24.8.0","_hasShrinkwrap":false,"devDependencies":{"sort-package-json":"^3.4.0"},"_npmOperationalInternal":{"tmp":"tmp/sort-object-keys_2.0.0_1758013482816_0.6381290195655962","host":"s3://npm-registry-packages-npm-production"},"readme":"# Sort Object\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\nimport assert from 'assert'\nimport sortObject from 'sort-object-keys'\n\nassert.equal(\n  JSON.stringify({\n    c: 1,\n    b: 1,\n    d: 1,\n    a: 1,\n  }),\n  JSON.stringify({\n    a: 1,\n    b: 1,\n    c: 1,\n    d: 1,\n  }),\n)\n\nassert.equal(\n  JSON.stringify(\n    sortObject(\n      {\n        c: 1,\n        b: 1,\n        d: 1,\n        a: 1,\n      },\n      ['b', 'a', 'd', 'c'],\n    ),\n  ),\n  JSON.stringify({\n    b: 1,\n    a: 1,\n    d: 1,\n    c: 1,\n  }),\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(\n  JSON.stringify(\n    sortObject(\n      {\n        'key-1': 1,\n        'key-3': 1,\n        'key-10': 1,\n        'key-2': 1,\n      },\n      removeKeyAncCompareIndex,\n    ),\n  ),\n  JSON.stringify({\n    'key-1': 1,\n    'key-2': 1,\n    'key-3': 1,\n    'key-10': 1,\n  }),\n)\n```\n","publish_time":1758013482988,"_cnpm_publish_time":1758013482988,"dist-tags":{"latest":"2.1.0"}}