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

Function splitStyleDeclarations

packages/sdk/src/engine/model.ts:164–183  ·  view source on GitHub ↗
(style: string)

Source from the content-addressed store, hash-verified

162}
163
164function splitStyleDeclarations(style: string): string[] {
165 const declarations: string[] = [];
166 const scan: StyleDeclarationScan = { depth: 0, quote: null, skip: false };
167 let start = 0;
168 for (let i = 0; i < style.length; i++) {
169 if (scan.skip) {
170 scan.skip = false;
171 continue;
172 }
173 const ch = style[i] ?? "";
174 if (ch === ";" && scan.depth === 0 && scan.quote === null) {
175 declarations.push(style.slice(start, i));
176 start = i + 1;
177 } else {
178 advanceStyleDeclarationScan(scan, ch, style[i + 1] ?? "");
179 }
180 }
181 declarations.push(style.slice(start));
182 return declarations;
183}
184
185function parseStyleAttr(styleAttr: string): Record<string, string> {
186 const result: Record<string, string> = {};

Callers 1

parseStyleAttrFunction · 0.85

Calls 1

Tested by

no test coverage detected