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

Method _parse

out/cli.cjs:31053–31117  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

31051 };
31052 var ZodArray = class _ZodArray extends ZodType {
31053 _parse(input) {
31054 const { ctx, status } = this._processInputParams(input);
31055 const def = this._def;
31056 if (ctx.parsedType !== util_1.ZodParsedType.array) {
31057 (0, parseUtil_1.addIssueToContext)(ctx, {
31058 code: ZodError_1.ZodIssueCode.invalid_type,
31059 expected: util_1.ZodParsedType.array,
31060 received: ctx.parsedType
31061 });
31062 return parseUtil_1.INVALID;
31063 }
31064 if (def.exactLength !== null) {
31065 const tooBig = ctx.data.length > def.exactLength.value;
31066 const tooSmall = ctx.data.length < def.exactLength.value;
31067 if (tooBig || tooSmall) {
31068 (0, parseUtil_1.addIssueToContext)(ctx, {
31069 code: tooBig ? ZodError_1.ZodIssueCode.too_big : ZodError_1.ZodIssueCode.too_small,
31070 minimum: tooSmall ? def.exactLength.value : void 0,
31071 maximum: tooBig ? def.exactLength.value : void 0,
31072 type: "array",
31073 inclusive: true,
31074 exact: true,
31075 message: def.exactLength.message
31076 });
31077 status.dirty();
31078 }
31079 }
31080 if (def.minLength !== null) {
31081 if (ctx.data.length < def.minLength.value) {
31082 (0, parseUtil_1.addIssueToContext)(ctx, {
31083 code: ZodError_1.ZodIssueCode.too_small,
31084 minimum: def.minLength.value,
31085 type: "array",
31086 inclusive: true,
31087 exact: false,
31088 message: def.minLength.message
31089 });
31090 status.dirty();
31091 }
31092 }
31093 if (def.maxLength !== null) {
31094 if (ctx.data.length > def.maxLength.value) {
31095 (0, parseUtil_1.addIssueToContext)(ctx, {
31096 code: ZodError_1.ZodIssueCode.too_big,
31097 maximum: def.maxLength.value,
31098 type: "array",
31099 inclusive: true,
31100 exact: false,
31101 message: def.maxLength.message
31102 });
31103 status.dirty();
31104 }
31105 }
31106 if (ctx.common.async) {
31107 return Promise.all([...ctx.data].map((item, i3) => {
31108 return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i3));
31109 })).then((result2) => {
31110 return parseUtil_1.ParseStatus.mergeArray(status, result2);

Callers

nothing calls this directly

Calls 6

_processInputParamsMethod · 0.80
dirtyMethod · 0.80
thenMethod · 0.80
_parseAsyncMethod · 0.80
mergeArrayMethod · 0.80
_parseSyncMethod · 0.80

Tested by

no test coverage detected