{"id":18553174,"url":"https://github.com/oliverspryn/semver","last_synced_at":"2026-04-13T20:31:39.773Z","repository":{"id":43288662,"uuid":"187862858","full_name":"oliverspryn/semver","owner":"oliverspryn","description":"A Kotlin library for parsing and comparing version numbers which adhere to the Semantic Versioning 2.0.0 standard","archived":false,"fork":false,"pushed_at":"2023-07-10T22:31:40.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-05-15T11:33:32.693Z","etag":null,"topics":["android","java","kotlin","library","semantic-version","semver"],"latest_commit_sha":null,"homepage":"https://semver.org","language":"Kotlin","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/oliverspryn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-21T15:13:27.000Z","updated_at":"2022-03-04T21:23:07.000Z","dependencies_parsed_at":"2024-12-26T08:41:26.337Z","dependency_job_id":"232c8bda-340c-4c1d-be9d-5cb950f8100e","html_url":"https://github.com/oliverspryn/semver","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/oliverspryn/semver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliverspryn%2Fsemver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliverspryn%2Fsemver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliverspryn%2Fsemver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliverspryn%2Fsemver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oliverspryn","download_url":"https://codeload.github.com/oliverspryn/semver/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliverspryn%2Fsemver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31770718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T20:17:16.280Z","status":"ssl_error","status_checked_at":"2026-04-13T20:17:08.216Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["android","java","kotlin","library","semantic-version","semver"],"created_at":"2024-11-06T21:16:18.178Z","updated_at":"2026-04-13T20:31:39.734Z","avatar_url":"https://github.com/oliverspryn.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Semver\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.oliverspryn.library/semver?label=Maven%20Central)](https://mvnrepository.com/artifact/com.oliverspryn.library/semver)\n[![Build Project](https://github.com/oliverspryn/semver/actions/workflows/build.yml/badge.svg)](https://github.com/oliverspryn/semver/actions/workflows/build.yml)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/939149ebbddd487b9beae339f0f2d836)](https://app.codacy.com/gh/oliverspryn/semver/)\n[![Maintainability](https://api.codeclimate.com/v1/badges/053a1e8e2bb58c5b2426/maintainability)](https://codeclimate.com/github/oliverspryn/semver/maintainability)\n![Current Release](https://img.shields.io/github/v/release/oliverspryn/semver?label=Latest%20Release\u0026sort=semver)\n\nA Kotlin library for parsing and comparing version numbers which adhere to the [Semantic Versioning 2.0.0 standard](https://semver.org). This library handles the most common semver version and pre-release version conventions. Here are a few examples of versions the library can understand:\n\n-   `0.0.1`\n-   `1.0.0`\n-   `2.1.136`\n-   `2.0.0-alpha`\n-   `2.0.0-alpha.1`\n-   `2.0.0-beta.12`\n-   `2.0.0-rc.3`\n\nHere are a few less common applications of the standard which are not supported by the library:\n\n-   `1.0.0-0.3.7`\n-   `1.0.0-x.7.z.92`\n-   `1.0.0-alpha.beta`\n\n## Getting Started\n\nTo import this library into your app using Gradle, follow these steps.\n\nFor reference, the current version of this library is: [![Maven Central](https://img.shields.io/maven-central/v/com.oliverspryn.library/semver?label=Maven%20Central)](https://mvnrepository.com/artifact/com.oliverspryn.library/semver)\n\n**build.gradle.kts**\n\n```kotlin\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    implementation(\"com.oliverspryn.library:semver:\u003ccurrent version tag without the v\u003e\")\n}\n```\n\n**build.gradle**\n\n```groovy\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    implementation \"com.oliverspryn.library:semver:\u003ccurrent version tag without the v\u003e\"\n}\n```\n\n## Applications of this Library\n\nThere are a variety of applications for which this library may be used. This section shows some common use cases. All of these examples can be tried out in the [main.kt file](https://github.com/oliverspryn/semver/blob/develop/src/main/kotlin/com/oliverspryn/library/main.kt) of the code.\n\n### Comparison\n\nPerhaps the most powerful aspect of this library is the ability to use comparison operators to perform version checks:\n\n```kotlin\nSemver(\"1.0.0\") == Semver(\"1.0.0\") // true\nSemver(\"1.0.0\").equals(\"1.0.0\") // true\nSemver(\"1.0.0\").equals(\"Something else\") // false\nSemver(\"1.0.0\") != Semver(\"2.0.0\") // true\n\nSemver(\"1.0.0\") \u003c Semver(\"2.0.0\") // true\nSemver(\"2.0.0\") \u003c= Semver(\"2.0.0\") // true\nSemver(\"2.1.0\") \u003e Semver(\"2.0.36\") // true\nSemver(\"2.1.0\") \u003e= Semver(\"2.0.36\") // true\n\nSemver(\"2.1.0-beta\") == Semver(\"2.1.0-beta.0\") // true\nSemver(\"2.1.0-beta.1\") == Semver(\"2.1.0-beta.0\") // false\nSemver(\"2.1.0-beta\") \u003e Semver(\"2.1.0-alpha.10\") // true\nSemver(\"2.1.0-beta.1\") \u003e Semver(\"2.1.0-beta\") // true\nSemver(\"2.1.0-rc.11\") \u003c Semver(\"2.1.0\") // true\n```\n\n### Components\n\nYou can also create `Semver` objects by passing in individual components of the version number:\n\n```kotlin\nval semver = Semver(1, 5, 12)\nprintln(semver) // 1.5.12\n\nprintln(semver.major) // 1\nprintln(semver.minor) // 5\nprintln(semver.patch) // 12\n\nval semverPrerelease = Semver(1, 5, 13, \"beta.1\")\nprintln(semverPrerelease) // 1.5.13-beta.1\nprintln(semverPrerelease.preReleaseVersion) // beta.1\n\nval semverString = Semver(\"1.5.14-alpha.10\")\nprintln(semverString) // 1.5.14-alpha.10\n\nprintln(semverString.major) // 1\nprintln(semverString.minor) // 5\nprintln(semverString.patch) // 14\nprintln(semverString.preReleaseVersion) // alpha.10\n```\n\n### Formatting\n\nThis library is also capable of performing some light formatting on the given input to conform it to the semver convention.\n\n```kotlin\nprintln(Semver(\"2.01.000100\")) // 2.1.100\nprintln(Semver(\"1.0.0-alpha.0\")) // 1.0.0-alpha\nprintln(Semver(\"1.0.00-ALphA.1\")) // 1.0.0-alpha.1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliverspryn%2Fsemver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foliverspryn%2Fsemver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliverspryn%2Fsemver/lists"}