bumpVersion

Increments a given (partial) version number to the next higher version.

Prerelease and build metadata information is ignored. The given version can skip the minor and patch digits. If no digits are skipped, the next minor version will be selected. If the patch or minor versions are skipped, the next major version will be selected.

This function corresponds to the semantivs of the "~>" comparison operator's upper bound.

The semantics of this are the same as for the "approximate" version specifier from rubygems. (https://github.com/rubygems/rubygems/tree/81d806d818baeb5dcb6398ca631d772a003d078e/lib/rubygems/version.rb)

@safe pure
string
bumpVersion
(
string ver
)

Examples

assertEquals("1.0.0", bumpVersion("0"));
assertEquals("1.0.0", bumpVersion("0.0"));
assertEquals("0.1.0", bumpVersion("0.0.0"));
assertEquals("1.3.0", bumpVersion("1.2.3"));
assertEquals("1.3.0", bumpVersion("1.2.3+metadata"));
assertEquals("1.3.0", bumpVersion("1.2.3-pre.release"));
assertEquals("1.3.0", bumpVersion("1.2.3-pre.release+metadata"));

See Also

expandVersion

Meta