Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

version-selector-type

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

version-selector-type

Returns the type and normalized version of a version selector

  • 3.0.0
  • next
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
85K
increased by3.56%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 02 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc