Socket
Socket
Sign inDemoInstall

version-selector-type

Package Overview
Dependencies
3
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    version-selector-type

Returns the type and normalized version of a version selector


Version published
Weekly downloads
220K
decreased by-13.4%
Maintainers
1
Install size
124 kB
Created
Weekly downloads
 

Readme

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

Last updated on 02 May 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc