UNPKG

youtube-video-id

Version:

Extracts the YouTube video ID from a URL or string.

3 lines (2 loc) 534 B
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).YouTubeVideoId=t()}(this,(function(){"use strict";var e=/(youtube\.com\/watch\?v=|youtu\.be\/)([0-9A-Za-z_-]{10}[048AEIMQUYcgkosw])/;return function(t){if("string"!=typeof t)throw new TypeError("First argument must be a string");var o=t.match(e);return(null==o?void 0:o.length)&&o[2]?o[2]:t}})); //# sourceMappingURL=youtube-video-id.min.js.map