function createVersionNumber(format, oldValue = null) {
    let [ type, modifier ] = format.split(':', 2);

    switch (type) {
        case 'hex':
        case 'hexadecimal':
            try {
                modifier = Number.parseInt(modifier);

                if (Number.isNaN(modifier)) {
                    modifier = 6;
                }

                return randomBytes(modifier).toString('hex');
            } catch (err) {
                throw new TypeError(
                    `${err.message} for \'format\' type "hexadecimal"`,
                    { cause: err }
                );
            }

        case 'inc':
        case 'increment':
            try {
                if (modifier === 'semver') {
                    return incrementSemVer(oldValue, [ 'buildmetadata', 'patch' ]);
                }

                return incrementNumber(oldValue, modifier);
            } catch (err) {
                throw new TypeError(
                    `${err.message} for \'format\' type "increment"`,
                    { cause: err }
                );
            }

        case 'regex':
        case 'regexp':
            try {
                return new RegExp(modifier);
            } catch (err) {
                throw new TypeError(
                    `${err.message} for \'format\' type "regexp"`,
                    { cause: err }
                );
            }

        case 'timestamp':
            return Date.now().valueOf();
    }

    throw new TypeError(
        'Expected \'format\' to be either "timestamp", "increment", or "hexadecimal"'
    );
}
Creates a formatted version number or string.

@param  {string}  format     - The version format.
@param  {?string} [oldValue] - The old version value.
@return {string|number}
@throws TypeError If the format or value are invalid.