version-selector-type
Returns the type and normalized version of a version selector
Last updated 8 years ago by zkochan .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install version-selector-type 
SYNC missed versions from official npm registry.

version-selector-type

Returns the type and normalized version of a version selector

npm version Build Status

Installation

npm i -S version-selector-type

Usage

'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 © Zoltan Kochan

Current Tags

  • 3.0.0                                ...           latest (6 years ago)
  • 3.0.0                                ...           next (6 years ago)

4 Versions

  • 3.0.0                                ...           6 years ago
  • 2.0.1                                ...           7 years ago
  • 2.0.0                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dependencies (1)
Dev Dependencies (4)

Copyright 2013 - present © cnpmjs.org | Home |