Function semverVersionBump

  • Bumps the semantic versioning (SemVer) of a given version string or array based on the specified level. The function supports 'major', 'minor', and 'patch' levels.

    Parameters

    • version: string | number[] | string[]

      The current version. It can be a string (e.g., '1.0.0') or an array of strings or numbers (e.g., ['1', '0', '0'] or [1, 0, 0]).

    • level: "patch" | "major" | "minor"

      The level of the version bump. It can be 'major', 'minor', or 'patch'.

    Returns string

    The bumped version as a string.

    Remarks

    This function will mutate the original version if it's an array.

    Example

    semverVersionBump('1.0.0', 'major'); // '2.0.0'
    semverVersionBump([1, 0, 4], 'minor'); // '1.1.0'
    semverVersionBump(['1', '0', '0'], 'patch'); // '1.0.1'

Generated using TypeDoc