diff --git a/package.json b/package.json index 04df17d..c892d6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "semver-utils", - "version": "1.0.0", + "version": "1.0.1", "description": "Tools for manipulating semver strings and objects", "main": "semver-utils.js", "scripts": { diff --git a/semver-utils.js b/semver-utils.js index 8cfd15c..2860ec1 100644 --- a/semver-utils.js +++ b/semver-utils.js @@ -29,6 +29,21 @@ 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) { var m , arr = [] @@ -68,5 +83,6 @@ } module.exports.parse = parseSemver; + module.exports.stringify = stringifySemver; module.exports.parseRange = parseSemverRange; }());