JSPM

version-selector-type

3.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 34417
  • Score
    100M100P100Q152448F
  • License MIT

Returns the type and normalized version of a version selector

Package Exports

  • version-selector-type

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (version-selector-type) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

version-selector-type

Returns the type and normalized version of a version selector

npm version Build Status

Installation

<pnpm|npm|yarn> add 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