MCPcopy
hub / github.com/di-sukharev/opencommit / getDiscriminator

Function getDiscriminator

out/cli.cjs:31611–31641  ·  view source on GitHub ↗
(type2)

Source from the content-addressed store, hash-verified

31609 });
31610 };
31611 var getDiscriminator = (type2) => {
31612 if (type2 instanceof ZodLazy) {
31613 return getDiscriminator(type2.schema);
31614 } else if (type2 instanceof ZodEffects) {
31615 return getDiscriminator(type2.innerType());
31616 } else if (type2 instanceof ZodLiteral) {
31617 return [type2.value];
31618 } else if (type2 instanceof ZodEnum) {
31619 return type2.options;
31620 } else if (type2 instanceof ZodNativeEnum) {
31621 return util_1.util.objectValues(type2.enum);
31622 } else if (type2 instanceof ZodDefault) {
31623 return getDiscriminator(type2._def.innerType);
31624 } else if (type2 instanceof ZodUndefined) {
31625 return [void 0];
31626 } else if (type2 instanceof ZodNull) {
31627 return [null];
31628 } else if (type2 instanceof ZodOptional) {
31629 return [void 0, ...getDiscriminator(type2.unwrap())];
31630 } else if (type2 instanceof ZodNullable) {
31631 return [null, ...getDiscriminator(type2.unwrap())];
31632 } else if (type2 instanceof ZodBranded) {
31633 return getDiscriminator(type2.unwrap());
31634 } else if (type2 instanceof ZodReadonly) {
31635 return getDiscriminator(type2.unwrap());
31636 } else if (type2 instanceof ZodCatch) {
31637 return getDiscriminator(type2._def.innerType);
31638 } else {
31639 return [];
31640 }
31641 };
31642 var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
31643 _parse(input) {
31644 const { ctx } = this._processInputParams(input);

Callers 1

createMethod · 0.85

Calls 2

innerTypeMethod · 0.80
unwrapMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…