zod-internationalization
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,2 +0,2 @@ | ||
import type { IssueData, ZodErrorMap, ZodInternationalizationOptions, ZodIssue } from "../ZodError"; | ||
import type { IssueData, ZodErrorMap, ZodInternationalization, ZodIssue } from "../ZodError"; | ||
import type { ZodParsedType } from "./util"; | ||
@@ -8,3 +8,3 @@ export declare const makeIssue: (params: { | ||
issueData: IssueData; | ||
internationalizationOptions: ZodInternationalizationOptions; | ||
internationalizationOptions: ZodInternationalization; | ||
}) => ZodIssue; | ||
@@ -11,0 +11,0 @@ export declare type ParseParams = { |
@@ -34,7 +34,3 @@ "use strict"; | ||
internationalizationOptions.overRideDefaults) { | ||
errorMaps.push((0, i18n_1.makeZodI18nMap)({ | ||
t: internationalizationOptions.t, | ||
ns: internationalizationOptions.defaultZodOverrideNs, | ||
handlePath: internationalizationOptions.handlePath, | ||
})); | ||
errorMaps.push((0, i18n_1.getInternationalizationErrorMap)()); | ||
} | ||
@@ -41,0 +37,0 @@ let errorMessage = ""; |
@@ -1,5 +0,6 @@ | ||
import { type ZodInternationalizationOptions } from "./ZodError"; | ||
import { type ZodInternationalizationOptions, type ZodInternationalization } from "./ZodError"; | ||
import { MakeZodI18nMap } from "./external"; | ||
export declare function setInternationalization(options: ZodInternationalizationOptions): void; | ||
export declare function getInternationalization(): ZodInternationalizationOptions; | ||
export declare function getInternationalizationErrorMap(): import("./ZodError").ZodErrorMap; | ||
export declare function getInternationalization(): ZodInternationalization; | ||
export declare const makeZodI18nMap: MakeZodI18nMap; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.makeZodI18nMap = exports.getInternationalization = exports.setInternationalization = void 0; | ||
exports.makeZodI18nMap = exports.getInternationalization = exports.getInternationalizationErrorMap = exports.setInternationalization = void 0; | ||
const ZodError_1 = require("./ZodError"); | ||
@@ -8,6 +8,16 @@ const errors_1 = require("./errors"); | ||
let internationalization = undefined; | ||
let internationalizationErrorMap = errors_1.defaultErrorMap; | ||
function setInternationalization(options) { | ||
internationalization = options; | ||
internationalizationErrorMap = (0, exports.makeZodI18nMap)({ | ||
t: options.t, | ||
ns: options.defaultZodOverrideNs, | ||
handlePath: options.handlePath, | ||
}); | ||
} | ||
exports.setInternationalization = setInternationalization; | ||
function getInternationalizationErrorMap() { | ||
return internationalizationErrorMap; | ||
} | ||
exports.getInternationalizationErrorMap = getInternationalizationErrorMap; | ||
function getInternationalization() { | ||
@@ -14,0 +24,0 @@ return internationalization; |
@@ -165,2 +165,3 @@ import type { TypeOf, ZodType } from "."; | ||
}; | ||
export declare type ZodInternationalization = ZodInternationalizationOptions | undefined; | ||
export declare type ZodInternationalizationOptions = { | ||
@@ -173,3 +174,3 @@ overRideMessages: boolean; | ||
handlePath?: HandlePathOption | false; | ||
} | undefined; | ||
}; | ||
export declare type ZodI18nMapOption = { | ||
@@ -176,0 +177,0 @@ t: i18n["t"]; |
{ | ||
"name": "zod-internationalization", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"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
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
697765
15997