index.js
function getYouTubeVideoId(string) {
    if (typeof string !== 'string') {
        throw new TypeError('First argument must be a string.');
    }
    var match = string.match(regex);
    if (match && match.length > 1) {
        return match[2];
    }
    return string;
}
function getYouTubeVideoId(string) {
    if (typeof string !== 'string') {
        throw new TypeError('First argument must be a string.');
    }
    var match = string.match(regex);
    if (match && match.length > 1) {
        return match[2];
    }
    return string;
}
function getYouTubeVideoId ( string ) { if ( typeof string !== 'string' ) { throw new TypeError ( 'First argument must be a string.' ) ; } var match = string . match ( regex ) ; if ( match && match . length > 1 ) { return match [ 2 ] ; } return string ; }
Get the YouTube video ID from a url or string.

@param  {String} string - The url or string.
@return {String}        - The video ID.
Get the YouTube video ID from a url or string .