@dofiltra/helpers
Advanced tools
Comparing version 1.0.42 to 1.0.43
@@ -60,2 +60,5 @@ import type { TDodecoratorSettings, TResultError, TTrackMetadata } from '@dofiltra/types'; | ||
}): string[]; | ||
static findYoutubeVideoIds({ text }: { | ||
text: string; | ||
}): string[]; | ||
static createHtmlTag: ({ tagName, innerHTML, attrs }: { | ||
@@ -62,0 +65,0 @@ tagName: string; |
@@ -141,2 +141,14 @@ /* tslint:disable:max-classes-per-file */ | ||
} | ||
static findYoutubeVideoIds({ text }) { | ||
// Regular expression to match YouTube URLs and capture the video ID, including YouTube Shorts | ||
const youtubeRegex = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?|shorts)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/g; | ||
// Array to store all the video IDs found | ||
const videoIds = []; | ||
let match; | ||
// Loop through all matches and add the video IDs to the array | ||
while ((match = youtubeRegex.exec(text)) !== null) { | ||
videoIds.push(match[1]); | ||
} | ||
return [...new Set(videoIds)]; | ||
} | ||
static createHtmlTag = ({ tagName, innerHTML, attrs }) => { | ||
@@ -143,0 +155,0 @@ const attributes = Object.keys(attrs || {}) |
{ | ||
"name": "@dofiltra/helpers", | ||
"version": "1.0.42", | ||
"version": "1.0.43", | ||
"license": "MIT", | ||
@@ -29,3 +29,3 @@ "main": "./lib/index.js", | ||
"devDependencies": { | ||
"@dofiltra/types": "^1.0.183", | ||
"@dofiltra/types": "^1.0.208", | ||
"@types/node": "^20.8.0", | ||
@@ -32,0 +32,0 @@ "prettier": "^3.0.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107064
2032