UNPKG

@pfantato/printful-ts

Version:

Typescript SDK to integrate with Printful

18 lines (17 loc) 580 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Localized = exports.Locale = void 0; const zod_1 = require("zod"); exports.Locale = zod_1.z .string() .regex(/^[a-zA-Z]{2}_[a-zA-Z]{2}$/, { message: "Language must be in the format 'xx_XX', e.g., en_US, es_ES, pt_BR.", }) .transform(val => { const [language, country] = val.split('_'); return `${language.toLowerCase()}_${country.toUpperCase()}`; }); const Localized = (schema) => schema.extend({ locale: exports.Locale.optional(), }); exports.Localized = Localized;