{"id":13474621,"url":"https://github.com/sindresorhus/semver-diff","last_synced_at":"2025-04-04T22:06:05.611Z","repository":{"id":16277874,"uuid":"19026265","full_name":"sindresorhus/semver-diff","owner":"sindresorhus","description":"Get the diff type of two semver versions: 0.0.1 0.0.2 → patch","archived":false,"fork":false,"pushed_at":"2021-05-03T12:27:57.000Z","size":16,"stargazers_count":68,"open_issues_count":2,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-28T21:05:32.841Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2014-04-22T10:51:05.000Z","updated_at":"2024-11-22T18:24:10.000Z","dependencies_parsed_at":"2022-09-11T04:41:22.552Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/semver-diff","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fsemver-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fsemver-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fsemver-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fsemver-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/semver-diff/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256112,"owners_count":20909240,"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-07-31T16:01:13.636Z","updated_at":"2025-04-04T22:06:05.592Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","readme":"# semver-diff\n\n\u003e Get the diff type of two [semver](https://github.com/npm/node-semver) versions: `0.0.1 0.0.2` → `patch`\n\n## Install\n\n```\n$ npm install semver-diff\n```\n\n## Usage\n\n```js\nimport semverDiff from 'semver-diff';\n\nsemverDiff('1.1.1', '1.1.2');\n//=\u003e 'patch'\n\nsemverDiff('1.1.1-foo', '1.1.2');\n//=\u003e 'prepatch'\n\nsemverDiff('0.0.1', '1.0.0');\n//=\u003e 'major'\n\nsemverDiff('0.0.1-foo', '1.0.0');\n//=\u003e 'premajor'\n\nsemverDiff('0.0.1', '0.1.0');\n//=\u003e 'minor'\n\nsemverDiff('0.0.1-foo', '0.1.0');\n//=\u003e 'preminor'\n\nsemverDiff('0.0.1-foo', '0.0.1-foo.bar');\n//=\u003e 'prerelease'\n\nsemverDiff('0.1.0', '0.1.0+foo');\n//=\u003e 'build'\n\nsemverDiff('0.0.1', '0.0.1');\n//=\u003e undefined\n\nsemverDiff('0.0.2', '0.0.1');\n//=\u003e undefined\n```\n\n## API\n\n### semverDiff(versionA, versionB)\n\nReturns the difference type between two semver versions, or `undefined` if they are identical or the second one is lower than the first.\n\nPossible values:\n\n- `'major'`,\n- `'premajor'`,\n- `'minor'`,\n- `'preminor'`,\n- `'patch'`,\n- `'prepatch'`,\n- `'prerelease'`,\n- `'build'`,\n- `undefined`\n\n## Related\n\n- [latest-semver](https://github.com/sindresorhus/latest-semver) - Get the latest stable semver version from an array of versions\n- [to-semver](https://github.com/sindresorhus/to-semver) - Get an array of valid, sorted, and cleaned semver versions from an array of strings\n- [semver-regex](https://github.com/sindresorhus/semver-regex) - Regular expression for matching semver versions\n- [semver-truncate](https://github.com/sindresorhus/semver-truncate) - Truncate a semver version: `1.2.3` → `1.2.0`\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\t\u003cb\u003e\n\t\t\u003ca href=\"https://tidelift.com/subscription/pkg/npm-semver-diff?utm_source=npm-semver-diff\u0026utm_medium=referral\u0026utm_campaign=readme\"\u003eGet professional support for this package with a Tidelift subscription\u003c/a\u003e\n\t\u003c/b\u003e\n\t\u003cbr\u003e\n\t\u003csub\u003e\n\t\tTidelift helps make open source sustainable for maintainers while giving companies\u003cbr\u003eassurances about security, maintenance, and licensing for their dependencies.\n\t\u003c/sub\u003e\n\u003c/div\u003e\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate","https://tidelift.com/subscription/pkg/npm-semver-diff?utm_source=npm-semver-diff\u0026utm_medium=referral\u0026utm_campaign=readme"],"categories":["JavaScript","Repository"],"sub_categories":["NPM"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fsemver-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fsemver-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fsemver-diff/lists"}