MCPcopy
hub / github.com/midrender/revideo / CODE

Function CODE

packages/2d/src/lib/code/CodeScope.ts:15–33  ·  view source on GitHub ↗
(
  strings: TemplateStringsArray,
  ...tags: CodeTag[]
)

Source from the content-addressed store, hash-verified

13export type CodeTag = SignalValue<PossibleCodeFragment | CodeScope | CodeTag[]>;
14
15export function CODE(
16 strings: TemplateStringsArray,
17 ...tags: CodeTag[]
18): CodeTag[] {
19 const result: CodeTag[] = [];
20 for (let i = 0; i < strings.length; i++) {
21 result.push(strings[i]);
22 const tag = tags[i];
23 if (tag !== undefined) {
24 if (Array.isArray(tag)) {
25 result.push(...tag);
26 } else {
27 result.push(tag);
28 }
29 }
30 }
31
32 return result;
33}
34
35export function isCodeScope(value: any): value is CodeScope {
36 return value?.fragments !== undefined;

Callers 3

editMethod · 0.90
appendMethod · 0.90
prependMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected