Skip to content

Commit

Permalink
fix syntax error following merge commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
igalklebanov committed Feb 27, 2023
1 parent 986c54d commit a6b1f0b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
2 changes: 2 additions & 0 deletions deno/lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://www.npmjs.com/package/zod">npm</a>
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://deno.land/x/zod">deno</a>
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://github.com/colinhacks/zod/issues/new">Issues</a>
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
<a href="https://twitter.com/colinhacks">@colinhacks</a>
Expand Down
14 changes: 9 additions & 5 deletions deno/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,10 @@ export class ZodString extends ZodType<string, ZodStringDef> {
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_string,
validation: "time",
message: check.message,
});
status.dirty();
}
} else if (check.kind === "ip") {
if (!isValidIP(input.data, check.version)) {
ctx = this._getOrReturnCtx(input, ctx);
Expand Down Expand Up @@ -853,19 +857,19 @@ export class ZodString extends ZodType<string, ZodStringDef> {
emoji(message?: errorUtil.ErrMessage) {
return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
}

uuid(message?: errorUtil.ErrMessage) {
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
}

cuid(message?: errorUtil.ErrMessage) {
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
}

cuid2(message?: errorUtil.ErrMessage) {
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
}

ip(options?: string | { version?: "v4" | "v6"; message?: string }) {
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
}
Expand Down Expand Up @@ -1028,15 +1032,15 @@ export class ZodString extends ZodType<string, ZodStringDef> {
get isEmoji() {
return !!this._def.checks.find((ch) => ch.kind === "emoji");
}

get isUUID() {
return !!this._def.checks.find((ch) => ch.kind === "uuid");
}

get isCUID() {
return !!this._def.checks.find((ch) => ch.kind === "cuid");
}

get isCUID2() {
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
}
Expand Down
14 changes: 9 additions & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,10 @@ export class ZodString extends ZodType<string, ZodStringDef> {
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_string,
validation: "time",
message: check.message,
});
status.dirty();
}
} else if (check.kind === "ip") {
if (!isValidIP(input.data, check.version)) {
ctx = this._getOrReturnCtx(input, ctx);
Expand Down Expand Up @@ -853,19 +857,19 @@ export class ZodString extends ZodType<string, ZodStringDef> {
emoji(message?: errorUtil.ErrMessage) {
return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
}

uuid(message?: errorUtil.ErrMessage) {
return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
}

cuid(message?: errorUtil.ErrMessage) {
return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
}

cuid2(message?: errorUtil.ErrMessage) {
return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
}

ip(options?: string | { version?: "v4" | "v6"; message?: string }) {
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
}
Expand Down Expand Up @@ -1028,15 +1032,15 @@ export class ZodString extends ZodType<string, ZodStringDef> {
get isEmoji() {
return !!this._def.checks.find((ch) => ch.kind === "emoji");
}

get isUUID() {
return !!this._def.checks.find((ch) => ch.kind === "uuid");
}

get isCUID() {
return !!this._def.checks.find((ch) => ch.kind === "cuid");
}

get isCUID2() {
return !!this._def.checks.find((ch) => ch.kind === "cuid2");
}
Expand Down

0 comments on commit a6b1f0b

Please sign in to comment.