Function incThrow

Return the version incremented by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease)

TypeError if the version string is invalid or if there are other errors

incThrow('1.2.3', 'minor') // '1.3.0'
incThrow('1.2', 'minor') // throws TypeError: Invalid Version: 1.2

unlike inc() which returns null if error occurs, this function could throw error

  • Parameters

    • version: string

      The version to increment

    • release: ReleaseType | "release"

      The release type to use, could be "major", "premajor", "minor", "preminor", "patch", "prepatch", "prerelease", 'release'

    • Optionalidentifier: string

      The identifier to use for prerelease versions

    • OptionalidentifierBase: false | IdentifierBase

      The base to use for the identifier, could be '0' or '1'

    • OptionaloptionsOrLoose: boolean | Options

      An options object { loose } (where loose is the only available option) or a boolean indicating whether to enable loose mode. In loose mode, the parser is more forgiving with imperfectly formatted semver strings

    Returns string

    The incremented version