{"id":18888353,"url":"https://github.com/pnpm/version-selector-type","last_synced_at":"2025-04-14T23:15:24.998Z","repository":{"id":52545728,"uuid":"115266014","full_name":"pnpm/version-selector-type","owner":"pnpm","description":"Returns the type of a version selector","archived":false,"fork":false,"pushed_at":"2023-08-03T06:45:20.000Z","size":264,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T02:29:52.704Z","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/pnpm.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}},"created_at":"2017-12-24T13:52:54.000Z","updated_at":"2022-01-30T02:21:38.000Z","dependencies_parsed_at":"2022-09-02T12:10:08.711Z","dependency_job_id":null,"html_url":"https://github.com/pnpm/version-selector-type","commit_stats":{"total_commits":19,"total_committers":3,"mean_commits":6.333333333333333,"dds":"0.42105263157894735","last_synced_commit":"95be76337c72c706ae195ebf97ca30f6624213fb"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnpm%2Fversion-selector-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnpm%2Fversion-selector-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnpm%2Fversion-selector-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pnpm%2Fversion-selector-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pnpm","download_url":"https://codeload.github.com/pnpm/version-selector-type/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248821699,"owners_count":21166932,"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-11-08T07:43:34.328Z","updated_at":"2025-04-14T23:15:24.975Z","avatar_url":"https://github.com/pnpm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# version-selector-type\n\n\u003e Returns the type and normalized version of a version selector\n\n\u003c!--@shields('npm', 'travis')--\u003e\n[![npm version](https://img.shields.io/npm/v/version-selector-type.svg)](https://www.npmjs.com/package/version-selector-type) [![Build Status](https://img.shields.io/travis/pnpm/version-selector-type/master.svg)](https://travis-ci.org/pnpm/version-selector-type)\n\u003c!--/@--\u003e\n\n## Installation\n\n```sh\n\u003cpnpm|npm|yarn\u003e add version-selector-type\n```\n\n## Usage\n\n\u003c!--@example('./example.js')--\u003e\n```js\n'use strict'\nconst getVersionSelectorType = require('version-selector-type')\n\nconsole.log(getVersionSelectorType('1.0.0'))\n//\u003e { normalized: '1.0.0', type: 'version' }\n\nconsole.log(getVersionSelectorType('^1.0.0'))\n//\u003e { normalized: '\u003e=1.0.0 \u003c2.0.0', type: 'range' }\n\nconsole.log(getVersionSelectorType('latest'))\n//\u003e { normalized: 'latest', type: 'tag' }\n\nconsole.log(getVersionSelectorType('github:zkochan/foo'))\n//\u003e null\n\nconsole.log(getVersionSelectorType('1.2.0beta'))\n//\u003e { normalized: '1.2.0-beta', type: 'version' }\n\nconsole.log(getVersionSelectorType.strict('1.2.0beta'))\n//\u003e { normalized: '1.2.0beta', type: 'tag' }\n```\n\u003c!--/@--\u003e\n\n## API\n\n### `getVersionSelectorType(selector)`\n\nReturns the type of the version selector and the normalized form of that selector.\nReturns `null` in case it is an unknown selector.\nInterprets versions and ranges loosely.\n\n### `getVersionSelectorType.strict(selector)`\n\nSame as `getVersionSelectorType()` but interprets versions and ranges not loosely.\n\n## License\n\n[MIT](./LICENSE) © [Zoltan Kochan](https://www.kochan.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpnpm%2Fversion-selector-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpnpm%2Fversion-selector-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpnpm%2Fversion-selector-type/lists"}