UNPKG

@featurevisor/core

Version:

Core package of Featurevisor for Node.js usage

22 lines 935 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getNextRevision = getNextRevision; function getNextRevision(currentRevision) { // If the string is empty or can't be parsed with parseInt(), return "1". if (!currentRevision || isNaN(parseInt(currentRevision, 10))) { return "1"; } // If the string is like an integer, increment it by 1 and return the value. if (currentRevision.indexOf(".") === -1) { return (parseInt(currentRevision, 10) + 1).toString(); } // If the string is a semver, parse the patch version out of it, increment it by one and return it. const parts = currentRevision.split("."); const lastPart = parseInt(parts[parts.length - 1], 10); if (!isNaN(lastPart)) { return (lastPart + 1).toString(); } // If the string can't be parsed as a semver, return "1". return "1"; } //# sourceMappingURL=revision.js.map