{"_id":"compare","_rev":"480427","name":"compare","description":"Compare primitives the right way (using `<`, `>` and `==`)","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"emilbayes","email":"github@tixz.dk"},{"name":"hughsk","email":"hughskennedy@gmail.com"}],"time":{"modified":"2021-08-05T09:34:07.000Z","created":"2013-06-17T02:46:31.719Z","2.0.0":"2018-05-11T16:59:18.710Z","0.0.1":"2013-06-17T02:46:31.719Z"},"users":{},"author":{"name":"Emil Bay","email":"github@tixz.dk"},"repository":{"type":"git","url":"git+https://github.com/emilbayes/compare.git"},"versions":{"2.0.0":{"name":"compare","version":"2.0.0","description":"Compare primitives the right way (using `<`, `>` and `==`)","main":"index.js","dependencies":{},"devDependencies":{},"scripts":{},"repository":{"type":"git","url":"git+https://github.com/emilbayes/compare.git"},"keywords":["compare","cmpstr","string","number","numeric","sort","stable","ascii"],"author":{"name":"Emil Bay","email":"github@tixz.dk"},"license":"ISC","bugs":{"url":"https://github.com/emilbayes/compare/issues"},"homepage":"https://github.com/emilbayes/compare#readme","gitHead":"637cd2c81a46b6a99641be5b3679cc337f1bb866","_id":"compare@2.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"emilbayes","email":"github@tixz.dk"},"dist":{"shasum":"8090b34dcb288f629e905972da69ea7a6d5922a0","size":1656,"noattachment":false,"key":"/compare/-/compare-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/compare/download/compare-2.0.0.tgz"},"maintainers":[{"name":"emilbayes","email":"github@tixz.dk"},{"name":"hughsk","email":"hughskennedy@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/compare_2.0.0_1526057958532_0.5564342051272659"},"_hasShrinkwrap":false,"publish_time":1526057958710,"_cnpm_publish_time":1526057958710},"0.0.1":{"name":"compare","version":"0.0.1","description":"ERROR: No README.md file found!","main":"index.js","scripts":{"test":"node test.js"},"repository":{"type":"git","url":"git://github.com/hughsk/compare.git"},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughskennedy.com/"},"license":"MIT","keywords":["compare","all","elements","array","comparison"],"devDependencies":{"tape":"~1.0.4"},"readmeFilename":"README.md","_id":"compare@0.0.1","dist":{"shasum":"610dd337e7d893a22e4f6a7d7869d9391f2be081","size":1534,"noattachment":false,"key":"/compare/-/compare-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/compare/download/compare-0.0.1.tgz"},"_npmVersion":"1.1.71","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"emilbayes","email":"github@tixz.dk"},{"name":"hughsk","email":"hughskennedy@gmail.com"}],"directories":{},"publish_time":1371437191719,"_cnpm_publish_time":1371437191719,"_hasShrinkwrap":false}},"readme":"# `compare`\n\n![100-correct](https://img.shields.io/badge/Correct%20-100%25-brightgreen.svg?style=flat)\n\n> Compare primitives the right way (using `<`, `>` and `==`)\n\nThis module does the right thing with numbers and ascii strings.\nNormally `String.prototype.localeCompare` is recommended for strings,\nbut that can have nasty side effects on some machines, eg.\n\n```js\n'cu'.localeCompare('cs', 'hu')\n```\n\nCompare the above in stock node (which doesn't come with `Intl`) and\na browser of your choice (which most likely has `Intl` support).\n\n## Usage\n\n```js\nvar compare = require('compare')\n[1, 2, 10].sort() // [1, 10, 2]\n[1, 2, 10].sort(compare) // [1, 2, 10]\n\n// Below is sorted correctly according to Hungarian, but runtimes without Intl\n// support will reorder them\n['cu', 'cs'].sort((a, b) => a.localeCompare(b, 'hu'))\n['cu', 'cs'].sort(compare) // This will always sort the same\n```\n\n## API\n\n### `compare(a, b)`\n\nStandard `Array.prototype.sort(cmp)` function signature. If `a > b` return `1`,\nif `a < b` return `-1`, otherwise return `0`\n\n## Credit\n\nThanks to [`hughsk`](https://github.com/hughsk) for the npm name!\n\n## Install\n\n```sh\nnpm install compare\n```\n\n## License\n\n[ISC](LICENSE)\n","_attachments":{},"homepage":"https://github.com/emilbayes/compare#readme","bugs":{"url":"https://github.com/emilbayes/compare/issues"},"license":"ISC"}