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

Method add

packages/zod/src/v4/core/registries.ts:33–43  ·  view source on GitHub ↗
(
    schema: S,
    ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]
  )

Source from the content-addressed store, hash-verified

31 _idmap: Map<string, Schema> = new Map();
32
33 add<S extends Schema>(
34 schema: S,
35 ..._meta: undefined extends Meta ? [$replace<Meta, S>?] : [$replace<Meta, S>]
36 ): this {
37 const meta: any = _meta[0];
38 this._map.set(schema, meta!);
39 if (meta && typeof meta === "object" && "id" in meta) {
40 this._idmap.set(meta.id!, schema);
41 }
42 return this as any;
43 }
44
45 clear(): this {
46 this._map = new WeakMap();

Callers 15

datetime-regex.tsFile · 0.80
ipv4-regex.tsFile · 0.80
union.tsFile · 0.80
instanceof.tsFile · 0.80
object-creation.tsFile · 0.80
benchWithDataFunction · 0.80
runMethod · 0.80
runMethod · 0.80
finalizeSetMethod · 0.80
union.tsFile · 0.80
primitives.tsFile · 0.80
object.tsFile · 0.80

Calls

no outgoing calls

Tested by 2

describeFunction · 0.64
describeFunction · 0.64