Comparing version 3.21.0 to 3.22.0-canary.20230305T082229
@@ -42,3 +42,9 @@ "use strict"; | ||
if (typeof issue.validation === "object") { | ||
if ("startsWith" in issue.validation) { | ||
if ("includes" in issue.validation) { | ||
message = `Invalid input: must include "${issue.validation.includes}"`; | ||
if (typeof issue.validation.position === "number") { | ||
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`; | ||
} | ||
} | ||
else if ("startsWith" in issue.validation) { | ||
message = `Invalid input: must start with "${issue.validation.startsWith}"`; | ||
@@ -45,0 +51,0 @@ } |
@@ -122,2 +122,7 @@ import { enumUtil } from "./helpers/enumUtil"; | ||
} | { | ||
kind: "includes"; | ||
value: string; | ||
position?: number; | ||
message?: string; | ||
} | { | ||
kind: "cuid2"; | ||
@@ -181,2 +186,6 @@ message?: string; | ||
regex(regex: RegExp, message?: errorUtil.ErrMessage): ZodString; | ||
includes(value: string, options?: { | ||
message?: string; | ||
position?: number; | ||
}): ZodString; | ||
startsWith(value: string, message?: errorUtil.ErrMessage): ZodString; | ||
@@ -183,0 +192,0 @@ endsWith(value: string, message?: errorUtil.ErrMessage): ZodString; |
@@ -74,2 +74,5 @@ import type { TypeOf, ZodType } from "."; | ||
export declare type StringValidation = "email" | "url" | "emoji" | "uuid" | "regex" | "cuid" | "cuid2" | "datetime" | "ip" | { | ||
includes: string; | ||
position?: number; | ||
} | { | ||
startsWith: string; | ||
@@ -76,0 +79,0 @@ } | { |
{ | ||
"name": "zod", | ||
"version": "3.21.0", | ||
"version": "3.22.0-canary.20230305T082229", | ||
"description": "TypeScript-first schema declaration and validation library with static type inference", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
606439
13986
2623
1