$ gnpm install parse-semver
Parse, normalize and validate given semver shorthand (e.g. gulp@v3.8.10) to object.
npm i parse-semver --save
npm test
For more use-cases see the tests
It returns object with
original
version given, expanded semverrange
, andversion
which is valid semver version.
<shorthand>
{String} the shorthand to parse, like docks@v2.2.0
return
{Object} object with few propertiesExample
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@^2.2.2')
//=> {name: 'docks', original: '^2.2.2', range: '>=2.2.2 <3.0.0', version: '2.2.2'}
parseSemver('docks')
//=> {name: 'docks', original: '', range: '*', version: 'latest'}
git log
style to array of objects from git repository… more.git/config
into a JavaScript object. sync or async.ware
, plugins
, koa-compose
and… morePull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.
Copyright 2013 - present © cnpmjs.org | Home |