{"name":"semiver","version":"1.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/semiver.git"},"description":"A tiny (153B) utility to compare semver strings","module":"dist/semiver.mjs","unpkg":"dist/semiver.min.js","main":"dist/semiver.js","types":"semiver.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"engines":{"node":">=8"},"scripts":{"build":"bundt","pretest":"npm run build","test":"tape -r esm test/*.js | tap-spec"},"keywords":["compare","semver","sort"],"devDependencies":{"bundt":"^0.4.0","esm":"^3.2.0","tap-spec":"^5.0.0","tape":"^4.9.1"},"gitHead":"b453c939319d06fff0e210f44f4ccd1c48a0cbee","bugs":{"url":"https://github.com/lukeed/semiver/issues"},"homepage":"https://github.com/lukeed/semiver#readme","_id":"semiver@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.16.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-Evip0gMqp01cTTt9v7gnRplb/FuL1Gv59UVfWbgrLslXJWR/QBARgX6IDKECMIRlKYYVUgE3VvzMpZhsTF5jHw==","shasum":"d3d33ca570ccc3dc38cb27c18446e888e9e78ee8","tarball":"http://registry-npm.ywwl.com/semiver/download/semiver-1.0.0.tgz","fileCount":7,"unpackedSize":5175,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc4K67CRA9TVsSAnZWagAAA/4P/A1f8iGUN5rfdZR4PlE1\nuGKCWYb0blIyTCp5fmm+geaYGGDxydVtznxkpA4iX4DDGR8kwoxbK38FsG7l\n0juRGJRwUHTV1XEyl83zmnV7LJfKGUc7RbMikcZVxTGQ8xd0nz7XUOTypTgA\nJqFNJYyOWKZHlAzDT8dv/0kJT+ke4M0Wuogjxe/8kwO1d34xfsW7tfmOM+2a\ni4GOTP3XfBjIvkaX2do4q7tA251GbwrBiN3g+8LgA7WVSe9R3aHLAMQTnT72\nXwfIOdKeKh+oxVp3/yj7eAB/pltBnOxk+r6n29g9OfBMXbf94Jiu/TiEnIPv\n3mbBffsYgs5aHsFSKAotBWXVgjUKcFoh8qtM7GaF2dQ1tQyOViq6rETWvddG\nG1qp2Are7kdoyvc6leRflK6CHgVv/ETXDOKpHXqQYhCg7TiKSSky9Xa1LH9h\nMz1DKKlzp3gMxxgByvCEXiFgBgkQ7WVX3i2Dk4CkJALNp3XZ6Y8oTZhjdQZ7\n2CCI2YLi5BTig3qWoAlWKnXThPj2bIfTa3fbXHrYiDb9vzqFKwx8xg5CAJj/\nwQd21xY6Fs8LKVIQuFHNFfzQpGc9v/zWIxMizaQoINJ85usYMvNEo7Hat8DU\nBynKcvezA04V5daPdC0wwntGqm7Y63c61No/EQJuQc79+n3Bjch5AJl4UYXK\neQ0m\r\n=O6QG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGxeixtcqnw2l6r1ZEewXb7tUHL2BQSTyHCzusjAn0jEAiBZ5yXubMO7vcGfoEcW6+fl8uugokGijqPI1lcl6YRXkg=="}],"size":2476,"noattachment":false,"key":"/semiver/-/semiver-1.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/semiver_1.0.0_1558228667060_0.2654345597353174"},"_hasShrinkwrap":false,"readme":"# semiver [![Build Status](https://badgen.now.sh/travis/lukeed/semiver)](https://travis-ci.org/lukeed/semiver)\n\n> A tiny (187B) utility to compare semver strings.\n\nCompare semver strings (eg, `1.8.2`, `2.0.0-next.6`, `0.0.0-alpha-1`, etc) using the [`Intl.Collator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator) class.<br>\nVersion suffixes are supported and are considered during comparison.\n\nThe output will always be `0`, `1`, or `-1`, allowing `semiver` to be used directly as a compare function for [`Array.sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).\n\nThis module exposes three module definitions:\n\n* **ES Module**: `dist/semiver.mjs`\n* **CommonJS**: `dist/semiver.js`\n* **UMD**: `dist/semiver.min.js`\n\n\n## Install\n\n```\n$ npm install --save semiver\n```\n\n\n## Usage\n\n```js\nimport semiver from 'semiver';\n\n// A === B\nsemiver('0.0.0', '0.0.0'); //=> 0\nsemiver('1.2.3', '1.2.3'); //=> 0\n\n// A > B\nsemiver('2.1.0', '1.9.0'); //=> 1\nsemiver('1.9.1', '1.9.0'); //=> 1\nsemiver('10.0.0', '1.0.0'); //=> 1\nsemiver('10.0.0', '8.9.0'); //=> 1\nsemiver('1.2.3-next.10', '1.2.3-next.6'); //=> 1\nsemiver('2.0.0-alpha-10', '2.0.0-alpha-6'); //=> 1\nsemiver('2.0.0-beta.1', '2.0.0-alpha.8'); //=> 1\n\n// A < B\nsemiver('1.9.0', '2.1.0'); //=> -1\nsemiver('1.9.0', '1.9.1'); //=> -1\nsemiver('1.0.0', '10.0.0'); //=> -1\nsemiver('8.9.0', '10.0.0'); //=> -1\nsemiver('1.2.3-next.6', '1.2.3-next.10'); //=> -1\nsemiver('2.0.0-alpha-6', '2.0.0-alpha-10'); //=> -1\nsemiver('2.0.0-alpha.8', '2.0.0-beta.1'); //=> -1\n\n// Sorting\n[\n  '4.11.6', '4.2.0',\n  '1.5.19', '1.5.5',\n  '1.0.0', '1.0.0-rc.1',\n  '1.2.3', '1.2.3-alpha',\n  '1.0.0-alpha.1', '1.0.0-alpha',\n  '1.0.0-beta.11', '1.0.0-beta'\n].sort(semiver);\n/*\n  [ '1.0.0-alpha',\n    '1.0.0-alpha.1',\n    '1.0.0-beta',\n    '1.0.0-beta.11',\n    '1.0.0-rc.1',\n    '1.0.0',\n    '1.2.3-alpha',\n    '1.2.3',\n    '1.5.5',\n    '1.5.19',\n    '4.2.0',\n    '4.11.6' ]\n*/\n```\n\n\n## API\n\n### semiver(a, b)\n\nReturns: `Number`\n\n* `0` indicates that `a` is equal to `b`\n* `-1` indicates that `a` is less than `b`\n* `1` indicates that `a` is greater than `b`\n\n#### a\nType: `String`\n\nThe input string to compare.\n\n#### b\nType: `String`\n\nThe string to compare against.\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","publish_time":1558228667235,"_cnpm_publish_time":1558228667235,"dist-tags":{"latest":"1.1.0"}}