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

Method _parse

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

Source from the content-addressed store, hash-verified

30615 this.max = this.lte;
30616 }
30617 _parse(input) {
30618 if (this._def.coerce) {
30619 input.data = BigInt(input.data);
30620 }
30621 const parsedType = this._getType(input);
30622 if (parsedType !== util_1.ZodParsedType.bigint) {
30623 const ctx2 = this._getOrReturnCtx(input);
30624 (0, parseUtil_1.addIssueToContext)(ctx2, {
30625 code: ZodError_1.ZodIssueCode.invalid_type,
30626 expected: util_1.ZodParsedType.bigint,
30627 received: ctx2.parsedType
30628 });
30629 return parseUtil_1.INVALID;
30630 }
30631 let ctx = void 0;
30632 const status = new parseUtil_1.ParseStatus();
30633 for (const check of this._def.checks) {
30634 if (check.kind === "min") {
30635 const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
30636 if (tooSmall) {
30637 ctx = this._getOrReturnCtx(input, ctx);
30638 (0, parseUtil_1.addIssueToContext)(ctx, {
30639 code: ZodError_1.ZodIssueCode.too_small,
30640 type: "bigint",
30641 minimum: check.value,
30642 inclusive: check.inclusive,
30643 message: check.message
30644 });
30645 status.dirty();
30646 }
30647 } else if (check.kind === "max") {
30648 const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
30649 if (tooBig) {
30650 ctx = this._getOrReturnCtx(input, ctx);
30651 (0, parseUtil_1.addIssueToContext)(ctx, {
30652 code: ZodError_1.ZodIssueCode.too_big,
30653 type: "bigint",
30654 maximum: check.value,
30655 inclusive: check.inclusive,
30656 message: check.message
30657 });
30658 status.dirty();
30659 }
30660 } else if (check.kind === "multipleOf") {
30661 if (input.data % check.value !== BigInt(0)) {
30662 ctx = this._getOrReturnCtx(input, ctx);
30663 (0, parseUtil_1.addIssueToContext)(ctx, {
30664 code: ZodError_1.ZodIssueCode.not_multiple_of,
30665 multipleOf: check.value,
30666 message: check.message
30667 });
30668 status.dirty();
30669 }
30670 } else {
30671 util_1.util.assertNever(check);
30672 }
30673 }
30674 return { status: status.value, value: input.data };

Callers

nothing calls this directly

Calls 3

_getTypeMethod · 0.80
_getOrReturnCtxMethod · 0.80
dirtyMethod · 0.80

Tested by

no test coverage detected