{"id":16244613,"url":"https://github.com/indexzero/conver","last_synced_at":"2025-03-19T18:33:16.617Z","repository":{"id":57206752,"uuid":"89019880","full_name":"indexzero/conver","owner":"indexzero","description":"Comparisons for concrete semantic versions (i.e. compare 1.2.3 instead of ^1.2.3)","archived":false,"fork":false,"pushed_at":"2018-04-03T21:06:29.000Z","size":24,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-18T21:04:25.977Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/indexzero.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-21T20:08:51.000Z","updated_at":"2024-07-03T09:11:23.000Z","dependencies_parsed_at":"2022-09-08T14:22:10.459Z","dependency_job_id":null,"html_url":"https://github.com/indexzero/conver","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fconver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fconver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fconver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indexzero%2Fconver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indexzero","download_url":"https://codeload.github.com/indexzero/conver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244013985,"owners_count":20383713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T14:19:56.917Z","updated_at":"2025-03-19T18:33:16.280Z","avatar_url":"https://github.com/indexzero.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# conver\n\nComparisons for concrete semantic versions (i.e. compare `1.2.3` instead of `^1.2.3`).\n\n## Motivation\n\n[semver] is a great implementation of semantic versioning; including _all the edge cases._ These edge cases are important in many scenarios, but often we are simply comparing two concrete versions (i.e. compare `1.2.3` instead of `^1.2.3`).\n\nIn this more limited use-case case including all 1000+ lines of [semver] into your bundle for a web application is a bit of overkill. `conver` aims to do _ONLY_ concrete version comparisons in a drastically smaller package size (currently 28 LOC excluding comments).\n\n## Usage\n\n`conver` exposes the same comparison methods you would expect from the [semver] package. Specifically:\n\n- `gt(v1, v2)`: returns `true` if `v1` is greater than `v2`.\n- `lt(v1, v2)`: returns `true` if `v1` is less than `v2`.\n- `equal(v1, v2)`: returns `true` if `v1` is equal to `v2`.\n- `compare(v1, v2)` returns 0 if `v1 == v2`, or 1 if `v1` is greater, or -1 if `v2` is greater.\n- `parse(v1)`: returns an array of `[major, minor, patch, build]`\n- `stringify(src)`: returns a string representation of the specified\n  `src` – an Array of `[major, minor, patch, build]`.\n\n``` js\nconver.gt('3.4.5', '1.2.3'); // true\nconver.gt('1.2.3', '3.4.5'); // false\n\nconver.lt('1.2.3', '3.4.5'); // true\nconver.lt('3.4.5', '1.2.3'); // false\n\nconver.eq('1.2.3', '9.8.0'); // false\nconver.eq('1.2.3', '1.2.3'); // true\n\nconver.parse('1.2.3');       // [1, 2, 3, '']\nconver.parse('1.2.3-alpha'); // [1, 2, 3, 'alpha']\n\nconver.stringify([1, 2, 3, 'alpha']); // '1.2.3-alpha'\nconver.stringify([1, 2, 3]);          // '1.2.3'\nconver.stringify([1, 2]);             // '1.2'\nconver.stringify([1]);                // '1'\n```\n\n## Test\n\nTests are written with [nyc], [assume], and [mocha]. They can be run with `npm`:\n\n```\nnpm test\n```\n\n##### LICENSE: MIT\n##### AUTHOR: [Charlie Robbins](https://github.com/indexzero)\n\n[nyc]: https://github.com/istanbuljs/nyc#readme\n[assume]: https://github.com/bigpipe/assume#readme\n[mocha]: https://mochajs.org/\n[semver]: https://github.com/npm/node-semver#readme\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findexzero%2Fconver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findexzero%2Fconver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findexzero%2Fconver/lists"}