JSPM

parse-semver

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 326040
  • Score
    100M100P100Q167741F
  • License

Parse, normalize and validate given semver shorthand (e.g. gulp@v3.8.10) to object.

Package Exports

  • parse-semver

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 (parse-semver) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm mit license build status coverage status deps status

Parse, normalize and validate given semver shorthand (e.g. gulp@v3.8.10) to object.

Install

npm i --save parse-semver
npm test

API

For more use-cases see the tests

parseSemver

It returns object with original version given, expanded semver range, and version which is valid semver version.

  • <shorthand> {String} the shorthand to parse, like mocha@v2.2.0
  • return {Object} object with few properties

Example

var parseSemver = require('parse-semver');

parseSemver('docks@~3.4.5');
//=> {name: 'docks', original: '~3.4.5', range: '>=3.4.5 <3.5.0', version: '3.4.5'}

parseSemver('docks@v1.2.3');
//=> {name: 'docks', original: 'v1.2.3', range: '1.2.3', version: '1.2.3'}

parseSemver('docks');
//=> {name: 'docks', original: '', range: '*', version: ''}

Author

Charlike Mike Reagent

License MIT license

Copyright (c) 2015 Charlike Mike Reagent, contributors.
Released under the MIT license.


Powered and automated by kdf, March 26, 2015