MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / execDataAttrPattern

Function execDataAttrPattern

packages/studio/src/utils/sourcePatcher.ts:238–243  ·  view source on GitHub ↗
(html: string, attr: string, value: string)

Source from the content-addressed store, hash-verified

236}
237
238function execDataAttrPattern(html: string, attr: string, value: string): TagMatch | null {
239 const pattern = new RegExp(`(<[^>]*\\b${attr}=(["'])${escapeRegex(value)}\\2[^>]*)>`, "i");
240 const match = pattern.exec(html);
241 if (match?.index == null) return null;
242 return { tag: match[1], start: match.index, end: match.index + match[1].length };
243}
244
245function findTagByClass(html: string, target: PatchTarget): TagMatch | null {
246 const classMatch = target.selector?.match(/^\.([a-zA-Z0-9_-]+)$/);

Callers 1

findTagByTargetFunction · 0.85

Calls 1

escapeRegexFunction · 0.70

Tested by

no test coverage detected