avancement planning
This commit is contained in:
+7
-4
@@ -1,8 +1,9 @@
|
||||
var _a;
|
||||
export const $output = Symbol("ZodOutput");
|
||||
export const $input = Symbol("ZodInput");
|
||||
export class $ZodRegistry {
|
||||
constructor() {
|
||||
this._map = new Map();
|
||||
this._map = new WeakMap();
|
||||
this._idmap = new Map();
|
||||
}
|
||||
add(schema, ..._meta) {
|
||||
@@ -17,7 +18,7 @@ export class $ZodRegistry {
|
||||
return this;
|
||||
}
|
||||
clear() {
|
||||
this._map = new Map();
|
||||
this._map = new WeakMap();
|
||||
this._idmap = new Map();
|
||||
return this;
|
||||
}
|
||||
@@ -36,7 +37,8 @@ export class $ZodRegistry {
|
||||
if (p) {
|
||||
const pm = { ...(this.get(p) ?? {}) };
|
||||
delete pm.id; // do not inherit id
|
||||
return { ...pm, ...this._map.get(schema) };
|
||||
const f = { ...pm, ...this._map.get(schema) };
|
||||
return Object.keys(f).length ? f : undefined;
|
||||
}
|
||||
return this._map.get(schema);
|
||||
}
|
||||
@@ -48,4 +50,5 @@ export class $ZodRegistry {
|
||||
export function registry() {
|
||||
return new $ZodRegistry();
|
||||
}
|
||||
export const globalRegistry = /*@__PURE__*/ registry();
|
||||
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
||||
export const globalRegistry = globalThis.__zod_globalRegistry;
|
||||
|
||||
Reference in New Issue
Block a user