{"id":24866479,"url":"https://github.com/eieste/versionparserjs","last_synced_at":"2025-03-26T19:22:38.460Z","repository":{"id":57391795,"uuid":"174519695","full_name":"eieste/VersionParserJS","owner":"eieste","description":null,"archived":false,"fork":false,"pushed_at":"2019-03-09T09:18:14.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T15:50:13.348Z","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/eieste.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}},"created_at":"2019-03-08T10:46:14.000Z","updated_at":"2020-07-30T16:40:57.000Z","dependencies_parsed_at":"2022-09-01T14:23:29.567Z","dependency_job_id":null,"html_url":"https://github.com/eieste/VersionParserJS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eieste%2FVersionParserJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eieste%2FVersionParserJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eieste%2FVersionParserJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eieste%2FVersionParserJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eieste","download_url":"https://codeload.github.com/eieste/VersionParserJS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245718862,"owners_count":20661176,"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":"2025-02-01T01:12:03.347Z","updated_at":"2025-03-26T19:22:38.427Z","avatar_url":"https://github.com/eieste.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Version Parser\n\n## Python Version\nhttps://pypi.org/project/version-parser/\n\n## JavaScript\n\n\nThe version parser is able to parse versions and figure out which of them are build in\none of the following three formats: Major-Version, Minor-Version and Build-Version.\n\nPossible input types are:\n\n| Version  | Typ               |\n|----------|-------------------|\n| v1.2.3   | Version           |\n| V1.2.3   | Version           |\n| v_1_2_3  | FILENAME          |\n| v1_2_3   | FILENAME          |\n| V_1_2_3  | FILENAME          |\n| V1_2_3   | FILENAME          |\n| 1_2_3    | FILENAME          |\n| VM1m2b3  | CLASSNAME_BUILD   |\n| VM1m2p3  | CLASSNAME_PATCH   |\n| vM1m2b3  | CLASSNAME_BUILD   |\n| vM1m2p3  | CLASSNAME_PATCH   |\n| 1.2.3    | STRIPPED_VERSION  |\n| 2312     | NUMBER            |\n\n\n## Install\n```bash\nnpm install version-parser\n```\n\n## Usage\n\nCreate object with the version as a String as initial parameter.\n\n```ecma script level 4\nconst version_parser = require(\"version-parser\");\n\nv1 = new version_parser.Version(\"v2.3.4\")\n```\n\n\nTo compare two version objects/numbers, simply put the versions as Strings into \nseperate objects and compare them using the logical operators.\n```javascript 1.8\nconst version_parser = require(\"version-parser\");\n\nv1 = new version_parser.Version(\"v2.3.4\")\nv2 = new version_parser.Version(\"v2.3.2\")\n\nconsole.log(v1.lt(v2))\n\u003e\u003e False\n\n\nconsole.log(v1.gt(v2))\n\u003e\u003e True\n\n\nconsole.log(v1.eq(v2))\n\u003e\u003e False\n\n```\n\n\nThe last digets behind the last dot should be the Patch or Build Version Number.\nDifferences in this area should be compatible to each other.\n```javascript 1.8\nconst version_parser = require(\"version-parser\");\n\n\nv1 = new version_parser.Version(\"v2.3.4\")\nv2 = new version_parser.Version(\"v2.3.5\")\n\n\nconsole.log(v1.eq(v2))\n\u003e\u003e False\n\n\nconsole.log(v1.compatible_version_with(v2))\n\u003e\u003e True\n\n```\n\nYou can also get only the Major, Minor or Build Version by using:\n\n````javascript 1.8\nconst version_parser = require(\"version-parser\");\nv = new version_parser.Version(\"v2.3.4\")\n\nv.get_major_version()\n2\nv.get_minor_version()\n3\nv.get_build_version()\n4\n````\n\nIt's possible to convert the version format, too:\n\n````javascript 1.8\nconst version_parser = require(\"version-parser\");\nv = new version_parser.Version(\"v2.3.4\"); //       # VersionType = Version\nconsole.log(v.get_type())\n\u003e\u003e VersionType.Version\n\nconsole.log(v.get_typed_version(new version_parser.VersionType.FILENAME))\n\u003e\u003e v_2_3_4\n````\n\nAny version can be represented by an Integer.\n\u003e The sections of major, minor, build/patched version should have a maximum of three digets.\n\n````javascript 1.8\nconst version_parser = require(\"version-parser\");\n\nv = new version_parser.Version(\"v2.3.4\")\nconsole.log(v.get_number())\n\u003e\u003e 2003004\n````\n\n\n## VersionTypes\n\n### VersionType.FILENAME\n```python\n\"v_\u003cMAJOR\u003e_\u003cMINOR\u003e_\u003cBUILD/PATCH\u003e\"\n```\n\n### VersionType.CLASSNAME\n```python\n\"VM\u003cMAJOR\u003em\u003cMINOR\u003eb\u003cBUILD/PATCH\u003e\"\n```\n\n### VersionType.VERSION\n```python\n\"v\u003cMAJOR\u003e.\u003cMINOR\u003e.\u003cBUILD/PATCH\u003e\"\n```\n\n### VersionType.STRIPPED_VERSION\n```python\n\"\u003cMAJOR\u003e.\u003cMINOR\u003e.\u003cBUILD/PATCH\u003e\"\n```\n\n### VersionType.NUMBER\n\u003e each section is filled zeros up to three digets\n```python\n\"\u003cMAJOR\u003e\u003cMINOR\u003e\u003cBUILD/PATCH\u003e\"\n```\n\n### VersionType.CLASSNAME_BUILD\n\u003e same like CLASSNAME_BUILD \n\n\n### VersionType.CLASSNAME_PATCH\n```python\n\"VM\u003cMAJOR\u003em\u003cMINOR\u003ep\u003cBUILD/PATCH\u003e\"\n                  ^\n                PATCH \n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feieste%2Fversionparserjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feieste%2Fversionparserjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feieste%2Fversionparserjs/lists"}