zod-internationalization
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -8,3 +8,3 @@ import type { IssueData, ZodErrorMap, ZodInternationalization, ZodIssue } from "../ZodError"; | ||
issueData: IssueData; | ||
internationalizationOptions: ZodInternationalization; | ||
internationalization: ZodInternationalization; | ||
}) => ZodIssue; | ||
@@ -11,0 +11,0 @@ export declare type ParseParams = { |
@@ -11,3 +11,3 @@ "use strict"; | ||
const makeIssue = (params) => { | ||
const { data, path, errorMaps, issueData, internationalizationOptions } = params; | ||
const { data, path, errorMaps, issueData, internationalization } = params; | ||
const fullPath = [...path, ...(issueData.path || [])]; | ||
@@ -18,2 +18,3 @@ const fullIssue = { | ||
}; | ||
const internationalizationOptions = internationalization(); | ||
if (issueData.message !== undefined) { | ||
@@ -66,3 +67,3 @@ let message = issueData.message; | ||
].filter((x) => !!x), | ||
internationalizationOptions: (0, i18n_1.getInternationalization)(), | ||
internationalization: (0, i18n_1.getInternationalization)(), | ||
}); | ||
@@ -69,0 +70,0 @@ ctx.common.issues.push(issue); |
@@ -7,6 +7,6 @@ "use strict"; | ||
const external_1 = require("./external"); | ||
let internationalization = undefined; | ||
let internationalization = () => undefined; | ||
let internationalizationErrorMap = errors_1.defaultErrorMap; | ||
function setInternationalization(options) { | ||
internationalization = options; | ||
internationalization = () => options; | ||
internationalizationErrorMap = (0, exports.makeZodI18nMap)({ | ||
@@ -13,0 +13,0 @@ t: options.t, |
@@ -165,3 +165,3 @@ import type { TypeOf, ZodType } from "."; | ||
}; | ||
export declare type ZodInternationalization = ZodInternationalizationOptions | undefined; | ||
export declare type ZodInternationalization = () => ZodInternationalizationOptions | undefined; | ||
export declare type ZodInternationalizationOptions = { | ||
@@ -168,0 +168,0 @@ overRideMessages: boolean; |
{ | ||
"name": "zod-internationalization", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"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
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
697912
16000