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

Function extractBlocks

packages/lint/src/utils.ts:63–76  ·  view source on GitHub ↗
(source: string, pattern: RegExp)

Source from the content-addressed store, hash-verified

61}
62
63export function extractBlocks(source: string, pattern: RegExp): ExtractedBlock[] {
64 const blocks: ExtractedBlock[] = [];
65 let match: RegExpExecArray | null;
66 const p = new RegExp(pattern.source, pattern.flags);
67 while ((match = p.exec(source)) !== null) {
68 blocks.push({
69 attrs: match[1] || "",
70 content: match[2] || "",
71 raw: match[0],
72 index: match.index,
73 });
74 }
75 return blocks;
76}
77
78/**
79 * Find the `<html>` open tag in the source. Distinct from `findRootTag`,

Callers 1

buildLintContextFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected