This commit is contained in:
Alex 2022-04-05 21:06:20 +12:00
commit 3737eb9b7a
1 changed files with 8 additions and 0 deletions

View File

@ -42,10 +42,18 @@ function getMutationByKey(key, mutations) {
return mutations.find((mutation) => mutation.entityKey === key).payload;
}
function linkParser(url) {
var regExp =
/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/;
var match = url.match(regExp);
return match && match[7].length == 11 ? match[7] : false;
}
module.exports = {
getBetweenStrings,
hexToRgb,
rgbToHex,
getCpn,
getMutationByKey,
linkParser,
};