MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / deepPartialify

Function deepPartialify

out/cli.cjs:31154–31179  ·  view source on GitHub ↗
(schema)

Source from the content-addressed store, hash-verified

31152 });
31153 };
31154 function deepPartialify(schema) {
31155 if (schema instanceof ZodObject) {
31156 const newShape = {};
31157 for (const key in schema.shape) {
31158 const fieldSchema = schema.shape[key];
31159 newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
31160 }
31161 return new ZodObject({
31162 ...schema._def,
31163 shape: () => newShape
31164 });
31165 } else if (schema instanceof ZodArray) {
31166 return new ZodArray({
31167 ...schema._def,
31168 type: deepPartialify(schema.element)
31169 });
31170 } else if (schema instanceof ZodOptional) {
31171 return ZodOptional.create(deepPartialify(schema.unwrap()));
31172 } else if (schema instanceof ZodNullable) {
31173 return ZodNullable.create(deepPartialify(schema.unwrap()));
31174 } else if (schema instanceof ZodTuple) {
31175 return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
31176 } else {
31177 return schema;
31178 }
31179 }
31180 var ZodObject = class _ZodObject extends ZodType {
31181 constructor() {
31182 super(...arguments);

Callers 1

deepPartialMethod · 0.85

Calls 2

unwrapMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…