function parseVersionKey(key) {
    if (key instanceof RegExp) {
        return key;
    }

    if (typeof key !== 'string') {
        throw new TypeError(
            'Expected \'key\' to be either a string or a RegExp'
        );
    }

    const delimiter = key.indexOf(':');

    if (delimiter === -1) {
        // Assumes its a JSON key
        return key;
    }

    const type  = key.slice(0, delimiter);
    const value = key.slice(delimiter + 1);

    switch (type) {
        case 'json':
            return value;

        case 'regex':
        case 'regexp':
            return new RegExp(value);
    }

    throw new TypeError(
        'Expected \'key\' type to be either "json" or "regexp"'
    );
}
Parses the version key.

@param  {*} key - The version key.
@return {string|RegExp}