All files / lib/builder revision.js

90.9% Statements 10/11
87.5% Branches 7/8
100% Functions 1/1
90.9% Lines 10/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  1x 1x     7x 2x     5x 2x     3x 3x 3x 3x          
"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);
    Eif (!isNaN(lastPart)) {
        return (lastPart + 1).toString();
    }
    // If the string can't be parsed as a semver, return "1".
    return "1";
}
//# sourceMappingURL=revision.js.map