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

1 assert("1.0.0" == bumpVersion("0"));
2 assert("1.0.0" == bumpVersion("0.0"));
3 assert("0.1.0" == bumpVersion("0.0.0"));
4 assert("1.3.0" == bumpVersion("1.2.3"));
5 assert("1.3.0" == bumpVersion("1.2.3+metadata"));
6 assert("1.3.0" == bumpVersion("1.2.3-pre.release"));
7 assert("1.3.0" == bumpVersion("1.2.3-pre.release+metadata"));

See Also

expandVersion

Meta