# version-selector-type

> Returns the type and normalized version of a version selector

Latest version **3.0.0** (published 2020-05-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install version-selector-type
pnpm add version-selector-type
yarn add version-selector-type
bun add version-selector-type
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2020-05-02 |
| First published | 2017-12-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.13 |
| Dependencies | 1 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Zoltan Kochan |
| Maintainers | zkochan |
| Keywords | semver, version, range, tag, dist-tag, selector |

## Links

- npm: https://www.npmjs.com/package/version-selector-type
- Repository: https://github.com/pnpm/version-selector-type
- Homepage: https://github.com/pnpm/version-selector-type#readme
- Issues: https://github.com/pnpm/version-selector-type/issues
- npm.io page: https://npm.io/package/version-selector-type

## Dependencies (1)

- [semver](https://npm.io/package/semver.md) ^7.3.2

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2020-05-02
- 2.0.1 — 2019-03-31
- 2.0.0 — 2017-12-25
- 1.0.0 — 2017-12-24

## README

# version-selector-type

> Returns the type and normalized version of a version selector

<!--@shields('npm', 'travis')-->
[![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)
<!--/@-->

## Installation

```sh
<pnpm|npm|yarn> add version-selector-type
```

## Usage

<!--@example('./example.js')-->
```js
'use strict'
const getVersionSelectorType = require('version-selector-type')

console.log(getVersionSelectorType('1.0.0'))
//> { normalized: '1.0.0', type: 'version' }

console.log(getVersionSelectorType('^1.0.0'))
//> { normalized: '>=1.0.0 <2.0.0', type: 'range' }

console.log(getVersionSelectorType('latest'))
//> { normalized: 'latest', type: 'tag' }

console.log(getVersionSelectorType('github:zkochan/foo'))
//> null

console.log(getVersionSelectorType('1.2.0beta'))
//> { normalized: '1.2.0-beta', type: 'version' }

console.log(getVersionSelectorType.strict('1.2.0beta'))
//> { normalized: '1.2.0beta', type: 'tag' }
```
<!--/@-->

## API

### `getVersionSelectorType(selector)`

Returns the type of the version selector and the normalized form of that selector.
Returns `null` in case it is an unknown selector.
Interprets versions and ranges loosely.

### `getVersionSelectorType.strict(selector)`

Same as `getVersionSelectorType()` but interprets versions and ranges not loosely.

## License

[MIT](./LICENSE) © [Zoltan Kochan](https://www.kochan.io/)

---
_Source: https://npm.io/package/version-selector-type · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
