MCPcopy
hub / github.com/colinhacks/zod / write

Method write

packages/zod/src/v4/core/doc.ts:20–34  ·  view source on GitHub ↗
(arg: any)

Source from the content-addressed store, hash-verified

18 write(fn: ModeWriter): void;
19 write(line: string): void;
20 write(arg: any) {
21 if (typeof arg === "function") {
22 (arg as ModeWriter)(this, { execution: "sync" });
23 (arg as ModeWriter)(this, { execution: "async" });
24 return;
25 }
26
27 const content = arg as string;
28 const lines = content.split("\n").filter((x) => x);
29 const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
30 const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
31 for (const line of dedented) {
32 this.content.push(line);
33 }
34 }
35
36 compile(): any {
37 const F = Function;

Callers 1

generateFastpassFunction · 0.95

Calls 1

minMethod · 0.65

Tested by

no test coverage detected