added missing stringify function
This commit is contained in:
parent
38f8d713a1
commit
65c47649af
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "semver-utils",
|
"name": "semver-utils",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "Tools for manipulating semver strings and objects",
|
"description": "Tools for manipulating semver strings and objects",
|
||||||
"main": "semver-utils.js",
|
"main": "semver-utils.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -29,6 +29,21 @@
|
||||||
return ver;
|
return ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stringifySemver(obj) {
|
||||||
|
var str = '';
|
||||||
|
str += obj.major || '0';
|
||||||
|
str += '.';
|
||||||
|
str += obj.minor || '0';
|
||||||
|
str += '.';
|
||||||
|
str += obj.patch || '0';
|
||||||
|
if (obj.release) {
|
||||||
|
str += '-' + obj.release;
|
||||||
|
}
|
||||||
|
if (obj.build) {
|
||||||
|
str += '+' + obj.build;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function parseSemverRange(str) {
|
function parseSemverRange(str) {
|
||||||
var m
|
var m
|
||||||
, arr = []
|
, arr = []
|
||||||
|
@ -68,5 +83,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.parse = parseSemver;
|
module.exports.parse = parseSemver;
|
||||||
|
module.exports.stringify = stringifySemver;
|
||||||
module.exports.parseRange = parseSemverRange;
|
module.exports.parseRange = parseSemverRange;
|
||||||
}());
|
}());
|
||||||
|
|
Loading…
Reference in New Issue