From 65c47649afe584fbca92ea4ab261fa5df9010934 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 24 Apr 2013 17:48:16 -0600 Subject: [PATCH] added missing stringify function --- package.json | 2 +- semver-utils.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) 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; }());