Comparing version 3.22.3 to 3.22.4
@@ -41,3 +41,3 @@ "use strict"; | ||
(0, errors_1.getErrorMap)(), | ||
en_1.default, | ||
en_1.default, // then global default map | ||
].filter((x) => !!x), | ||
@@ -44,0 +44,0 @@ }); |
@@ -33,4 +33,4 @@ "use strict"; | ||
}; | ||
util.objectKeys = typeof Object.keys === "function" | ||
? (obj) => Object.keys(obj) | ||
util.objectKeys = typeof Object.keys === "function" // eslint-disable-line ban/ban | ||
? (obj) => Object.keys(obj) // eslint-disable-line ban/ban | ||
: (object) => { | ||
@@ -53,3 +53,3 @@ const keys = []; | ||
util.isInteger = typeof Number.isInteger === "function" | ||
? (val) => Number.isInteger(val) | ||
? (val) => Number.isInteger(val) // eslint-disable-line ban/ban | ||
: (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val; | ||
@@ -74,3 +74,3 @@ function joinValues(array, separator = " | ") { | ||
...first, | ||
...second, | ||
...second, // second overwrites first | ||
}; | ||
@@ -77,0 +77,0 @@ }; |
@@ -63,2 +63,3 @@ import { enumUtil } from "./helpers/enumUtil"; | ||
safeParseAsync(data: unknown, params?: Partial<ParseParams>): Promise<SafeParseReturnType<Input, Output>>; | ||
/** Alias of safeParseAsync */ | ||
spa: (data: unknown, params?: Partial<ParseParams> | undefined) => Promise<SafeParseReturnType<Input, Output>>; | ||
@@ -173,3 +174,3 @@ refine<RefinedOutput extends Output>(check: (arg: Output) => arg is RefinedOutput, message?: string | CustomErrorParams | ((arg: Output) => CustomErrorParams)): ZodEffects<this, RefinedOutput, Input>; | ||
_parse(input: ParseInput): ParseReturnType<string>; | ||
protected _regex: (regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage | undefined) => ZodEffects<this, string, string>; | ||
protected _regex(regex: RegExp, validation: StringValidation, message?: errorUtil.ErrMessage): ZodEffects<this, string, string>; | ||
_addCheck(check: ZodStringCheck): ZodString; | ||
@@ -202,6 +203,10 @@ email(message?: errorUtil.ErrMessage): ZodString; | ||
length(len: number, message?: errorUtil.ErrMessage): ZodString; | ||
nonempty: (message?: errorUtil.ErrMessage | undefined) => ZodString; | ||
trim: () => ZodString; | ||
toLowerCase: () => ZodString; | ||
toUpperCase: () => ZodString; | ||
/** | ||
* @deprecated Use z.string().min(1) instead. | ||
* @see {@link ZodString.min} | ||
*/ | ||
nonempty(message?: errorUtil.ErrMessage): ZodString; | ||
trim(): ZodString; | ||
toLowerCase(): ZodString; | ||
toUpperCase(): ZodString; | ||
get isDatetime(): boolean; | ||
@@ -499,5 +504,17 @@ get isEmail(): boolean; | ||
passthrough(): ZodObject<T, "passthrough", Catchall>; | ||
/** | ||
* @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped. | ||
* If you want to pass through unknown properties, use `.passthrough()` instead. | ||
*/ | ||
nonstrict: () => ZodObject<T, "passthrough", Catchall>; | ||
extend<Augmentation extends ZodRawShape>(augmentation: Augmentation): ZodObject<objectUtil.extendShape<T, Augmentation>, UnknownKeys, Catchall>; | ||
/** | ||
* @deprecated Use `.extend` instead | ||
* */ | ||
augment: <Augmentation extends ZodRawShape>(augmentation: Augmentation) => ZodObject<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, UnknownKeys, Catchall, objectOutputType<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, Catchall, UnknownKeys>, objectInputType<{ [k in keyof (Omit<T, keyof Augmentation> & Augmentation)]: (Omit<T, keyof Augmentation> & Augmentation)[k]; }, Catchall, UnknownKeys>>; | ||
/** | ||
* Prior to zod@1.0.12 there was a bug in the | ||
* inferred type of merged objects. Please | ||
* upgrade if you are experiencing issues. | ||
*/ | ||
merge<Incoming extends AnyZodObject, Augmentation extends Incoming["shape"]>(merging: Incoming): ZodObject<objectUtil.extendShape<T, Augmentation>, Incoming["_def"]["unknownKeys"], Incoming["_def"]["catchall"]>; | ||
@@ -514,2 +531,5 @@ setKey<Key extends string, Schema extends ZodTypeAny>(key: Key, schema: Schema): ZodObject<T & { | ||
}>(mask: Mask): ZodObject<Omit<T, keyof Mask>, UnknownKeys, Catchall>; | ||
/** | ||
* @deprecated | ||
*/ | ||
deepPartial(): partialUtil.DeepPartial<this>; | ||
@@ -566,2 +586,10 @@ partial(): ZodObject<{ | ||
get optionsMap(): Map<Primitive, ZodDiscriminatedUnionOption<any>>; | ||
/** | ||
* The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor. | ||
* However, it only allows a union of objects, all of which need to share a discriminator property. This property must | ||
* have a different value for each object in the union. | ||
* @param discriminator the name of the discriminator property | ||
* @param types an array of object schemas | ||
* @param params | ||
*/ | ||
static create<Discriminator extends string, Types extends [ | ||
@@ -568,0 +596,0 @@ ZodDiscriminatedUnionOption<Discriminator>, |
@@ -40,2 +40,3 @@ "use strict"; | ||
if (Object.setPrototypeOf) { | ||
// eslint-disable-next-line ban/ban | ||
Object.setPrototypeOf(this, actualProto); | ||
@@ -80,2 +81,9 @@ } | ||
curr[el] = curr[el] || { _errors: [] }; | ||
// if (typeof el === "string") { | ||
// curr[el] = curr[el] || { _errors: [] }; | ||
// } else if (typeof el === "number") { | ||
// const errorArray: any = []; | ||
// errorArray._errors = []; | ||
// curr[el] = curr[el] || errorArray; | ||
// } | ||
} | ||
@@ -82,0 +90,0 @@ else { |
{ | ||
"name": "zod", | ||
"version": "3.22.3", | ||
"version": "3.22.4", | ||
"author": "Colin McDonnell <colin@colinhacks.com>", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
627817
14308
2835