@hy_ong/zod-kit 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +24 -0
- package/CLAUDE.md +64 -22
- package/dist/chunk-2SWEVDFZ.js +134 -0
- package/dist/chunk-32JI34CV.cjs +146 -0
- package/dist/chunk-42C5OHRK.js +71 -0
- package/dist/chunk-46VAH2BJ.js +160 -0
- package/dist/chunk-5JGTDL3Y.js +87 -0
- package/dist/chunk-5LEXCVLX.js +257 -0
- package/dist/chunk-6AAP4LPF.js +2606 -0
- package/dist/chunk-B4EZYZOK.cjs +215 -0
- package/dist/chunk-COYKBWTI.js +161 -0
- package/dist/chunk-DFJZ3NS2.cjs +151 -0
- package/dist/chunk-EDHT4LPO.js +118 -0
- package/dist/chunk-EGHL277K.cjs +165 -0
- package/dist/chunk-ERH4NIMU.cjs +69 -0
- package/dist/chunk-FM3EZ72O.js +165 -0
- package/dist/chunk-GJIRDBZJ.cjs +90 -0
- package/dist/chunk-H2XTEM4M.js +696 -0
- package/dist/chunk-HMSM6FFA.cjs +181 -0
- package/dist/chunk-HTEHINI7.cjs +177 -0
- package/dist/chunk-JOLSGZGN.cjs +696 -0
- package/dist/chunk-JXY7APBU.js +69 -0
- package/dist/chunk-K2UOY6TB.js +136 -0
- package/dist/chunk-KFOHKTFD.js +61 -0
- package/dist/chunk-L4HSIKTU.cjs +135 -0
- package/dist/chunk-LH7ZB4BK.js +124 -0
- package/dist/chunk-LL4ZWLGO.js +90 -0
- package/dist/chunk-M6MTP3NY.cjs +99 -0
- package/dist/chunk-MHJFYYGV.js +215 -0
- package/dist/chunk-MINMXGW3.js +135 -0
- package/dist/chunk-MM7IL2RG.js +181 -0
- package/dist/chunk-OPQJWHXN.cjs +301 -0
- package/dist/chunk-ORFHDJII.cjs +136 -0
- package/dist/chunk-ORVV4MCF.cjs +87 -0
- package/dist/chunk-QICQ6YEY.js +75 -0
- package/dist/chunk-RKUQREMW.js +127 -0
- package/dist/chunk-RO47DKQG.js +146 -0
- package/dist/chunk-RRPXIRTQ.cjs +257 -0
- package/dist/chunk-RYFG2GKM.cjs +118 -0
- package/dist/chunk-STNHTRG7.cjs +124 -0
- package/dist/chunk-TFGS34VD.cjs +71 -0
- package/dist/chunk-TQXDUMML.cjs +61 -0
- package/dist/chunk-UBK3VCVH.cjs +134 -0
- package/dist/chunk-UCOXAZJF.cjs +2606 -0
- package/dist/chunk-UQZKFAFX.js +130 -0
- package/dist/chunk-VB2KV2ZM.cjs +130 -0
- package/dist/chunk-WABKPFPK.js +151 -0
- package/dist/chunk-WDI4QJMQ.js +177 -0
- package/dist/chunk-YDH3L27K.cjs +127 -0
- package/dist/chunk-YIM3D2AD.js +99 -0
- package/dist/chunk-YPSEIDUR.cjs +160 -0
- package/dist/chunk-ZNJLWJX3.cjs +75 -0
- package/dist/chunk-ZTFCJCPO.cjs +161 -0
- package/dist/chunk-ZXUMK2RR.js +301 -0
- package/dist/common/boolean.cjs +7 -0
- package/dist/common/boolean.d.cts +119 -0
- package/dist/common/boolean.d.ts +119 -0
- package/dist/common/boolean.js +7 -0
- package/dist/common/color.cjs +9 -0
- package/dist/common/color.d.cts +26 -0
- package/dist/common/color.d.ts +26 -0
- package/dist/common/color.js +9 -0
- package/dist/common/coordinate.cjs +11 -0
- package/dist/common/coordinate.d.cts +23 -0
- package/dist/common/coordinate.d.ts +23 -0
- package/dist/common/coordinate.js +11 -0
- package/dist/common/credit-card.cjs +11 -0
- package/dist/common/credit-card.d.cts +22 -0
- package/dist/common/credit-card.d.ts +22 -0
- package/dist/common/credit-card.js +11 -0
- package/dist/common/date.cjs +7 -0
- package/dist/common/date.d.cts +174 -0
- package/dist/common/date.d.ts +174 -0
- package/dist/common/date.js +7 -0
- package/dist/common/datetime.cjs +15 -0
- package/dist/common/datetime.d.cts +301 -0
- package/dist/common/datetime.d.ts +301 -0
- package/dist/common/datetime.js +15 -0
- package/dist/common/email.cjs +7 -0
- package/dist/common/email.d.cts +149 -0
- package/dist/common/email.d.ts +149 -0
- package/dist/common/email.js +7 -0
- package/dist/common/file.cjs +7 -0
- package/dist/common/file.d.cts +178 -0
- package/dist/common/file.d.ts +178 -0
- package/dist/common/file.js +7 -0
- package/dist/common/id.cjs +13 -0
- package/dist/common/id.d.cts +288 -0
- package/dist/common/id.d.ts +288 -0
- package/dist/common/id.js +13 -0
- package/dist/common/ip.cjs +11 -0
- package/dist/common/ip.d.cts +25 -0
- package/dist/common/ip.d.ts +25 -0
- package/dist/common/ip.js +11 -0
- package/dist/common/number.cjs +7 -0
- package/dist/common/number.d.cts +167 -0
- package/dist/common/number.d.ts +167 -0
- package/dist/common/number.js +7 -0
- package/dist/common/password.cjs +7 -0
- package/dist/common/password.d.cts +192 -0
- package/dist/common/password.d.ts +192 -0
- package/dist/common/password.js +7 -0
- package/dist/common/text.cjs +7 -0
- package/dist/common/text.d.cts +156 -0
- package/dist/common/text.d.ts +156 -0
- package/dist/common/text.js +7 -0
- package/dist/common/time.cjs +15 -0
- package/dist/common/time.d.cts +268 -0
- package/dist/common/time.d.ts +268 -0
- package/dist/common/time.js +15 -0
- package/dist/common/url.cjs +7 -0
- package/dist/common/url.d.cts +196 -0
- package/dist/common/url.d.ts +196 -0
- package/dist/common/url.js +7 -0
- package/dist/config-CABSSvAp.d.cts +5 -0
- package/dist/config-CABSSvAp.d.ts +5 -0
- package/dist/index.cjs +180 -5255
- package/dist/index.d.cts +28 -3150
- package/dist/index.d.ts +28 -3150
- package/dist/index.js +135 -5131
- package/dist/taiwan/bank-account.cjs +11 -0
- package/dist/taiwan/bank-account.d.cts +22 -0
- package/dist/taiwan/bank-account.d.ts +22 -0
- package/dist/taiwan/bank-account.js +11 -0
- package/dist/taiwan/business-id.cjs +9 -0
- package/dist/taiwan/business-id.d.cts +133 -0
- package/dist/taiwan/business-id.d.ts +133 -0
- package/dist/taiwan/business-id.js +9 -0
- package/dist/taiwan/fax.cjs +9 -0
- package/dist/taiwan/fax.d.cts +157 -0
- package/dist/taiwan/fax.d.ts +157 -0
- package/dist/taiwan/fax.js +9 -0
- package/dist/taiwan/invoice.cjs +9 -0
- package/dist/taiwan/invoice.d.cts +17 -0
- package/dist/taiwan/invoice.d.ts +17 -0
- package/dist/taiwan/invoice.js +9 -0
- package/dist/taiwan/license-plate.cjs +9 -0
- package/dist/taiwan/license-plate.d.cts +19 -0
- package/dist/taiwan/license-plate.d.ts +19 -0
- package/dist/taiwan/license-plate.js +9 -0
- package/dist/taiwan/mobile.cjs +9 -0
- package/dist/taiwan/mobile.d.cts +146 -0
- package/dist/taiwan/mobile.d.ts +146 -0
- package/dist/taiwan/mobile.js +9 -0
- package/dist/taiwan/national-id.cjs +15 -0
- package/dist/taiwan/national-id.d.cts +214 -0
- package/dist/taiwan/national-id.d.ts +214 -0
- package/dist/taiwan/national-id.js +15 -0
- package/dist/taiwan/passport.cjs +9 -0
- package/dist/taiwan/passport.d.cts +19 -0
- package/dist/taiwan/passport.d.ts +19 -0
- package/dist/taiwan/passport.js +9 -0
- package/dist/taiwan/postal-code.cjs +17 -0
- package/dist/taiwan/postal-code.d.cts +237 -0
- package/dist/taiwan/postal-code.d.ts +237 -0
- package/dist/taiwan/postal-code.js +17 -0
- package/dist/taiwan/tel.cjs +9 -0
- package/dist/taiwan/tel.d.cts +162 -0
- package/dist/taiwan/tel.d.ts +162 -0
- package/dist/taiwan/tel.js +9 -0
- package/package.json +132 -6
- package/src/i18n/locales/en-GB.json +51 -0
- package/src/i18n/locales/en-US.json +52 -1
- package/src/i18n/locales/id-ID.json +51 -0
- package/src/i18n/locales/ja-JP.json +51 -0
- package/src/i18n/locales/ko-KR.json +51 -0
- package/src/i18n/locales/ms-MY.json +51 -0
- package/src/i18n/locales/th-TH.json +51 -0
- package/src/i18n/locales/vi-VN.json +51 -0
- package/src/i18n/locales/zh-CN.json +51 -0
- package/src/i18n/locales/zh-TW.json +51 -0
- package/src/index.ts +10 -2
- package/src/validators/common/color.ts +192 -0
- package/src/validators/common/coordinate.ts +159 -0
- package/src/validators/common/credit-card.ts +134 -0
- package/src/validators/common/id.ts +45 -3
- package/src/validators/common/ip.ts +210 -0
- package/src/validators/taiwan/bank-account.ts +176 -0
- package/src/validators/taiwan/invoice.ts +84 -0
- package/src/validators/taiwan/license-plate.ts +110 -0
- package/src/validators/taiwan/passport.ts +103 -0
- package/tests/common/color.test.ts +587 -0
- package/tests/common/coordinate.test.ts +345 -0
- package/tests/common/credit-card.test.ts +378 -0
- package/tests/common/id.test.ts +68 -3
- package/tests/common/ip.test.ts +419 -0
- package/tests/taiwan/bank-account.test.ts +286 -0
- package/tests/taiwan/invoice.test.ts +227 -0
- package/tests/taiwan/license-plate.test.ts +280 -0
- package/tests/taiwan/passport.test.ts +277 -0
- package/tsup.config.ts +36 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { ZodString, ZodNullable } from 'zod';
|
|
2
|
+
import { L as Locale } from '../config-CABSSvAp.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview Taiwan Postal Code validator for Zod Kit
|
|
6
|
+
*
|
|
7
|
+
* Provides comprehensive validation for Taiwan postal codes with support for
|
|
8
|
+
* 3-digit, 5-digit (legacy), and 6-digit (current) formats based on official
|
|
9
|
+
* Chunghwa Post specifications.
|
|
10
|
+
*
|
|
11
|
+
* @author Ong Hoe Yuan
|
|
12
|
+
* @version 0.0.5
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Type definition for postal code validation error messages
|
|
17
|
+
*
|
|
18
|
+
* @interface TwPostalCodeMessages
|
|
19
|
+
* @property {string} [required] - Message when field is required but empty
|
|
20
|
+
* @property {string} [invalid] - Message when postal code format is invalid
|
|
21
|
+
* @property {string} [invalidFormat] - Message when format doesn't match expected pattern
|
|
22
|
+
* @property {string} [invalidRange] - Message when postal code is outside valid range
|
|
23
|
+
* @property {string} [legacy5DigitWarning] - Warning message for 5-digit legacy format
|
|
24
|
+
* @property {string} [format3Only] - Message when only 3-digit format is allowed
|
|
25
|
+
* @property {string} [format5Only] - Message when only 5-digit format is allowed
|
|
26
|
+
* @property {string} [format6Only] - Message when only 6-digit format is allowed
|
|
27
|
+
*/
|
|
28
|
+
type TwPostalCodeMessages = {
|
|
29
|
+
required?: string;
|
|
30
|
+
invalid?: string;
|
|
31
|
+
invalidFormat?: string;
|
|
32
|
+
invalidRange?: string;
|
|
33
|
+
legacy5DigitWarning?: string;
|
|
34
|
+
format3Only?: string;
|
|
35
|
+
format5Only?: string;
|
|
36
|
+
format6Only?: string;
|
|
37
|
+
invalidSuffix?: string;
|
|
38
|
+
deprecated5Digit?: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Postal code format types supported in Taiwan
|
|
42
|
+
*
|
|
43
|
+
* @typedef {"3" | "5" | "6" | "3+5" | "3+6" | "5+6" | "all"} TwPostalCodeFormatType
|
|
44
|
+
*
|
|
45
|
+
* Available formats:
|
|
46
|
+
* - "3": 3-digit basic postal codes (100-982)
|
|
47
|
+
* - "5": 5-digit postal codes (3+2 format, legacy)
|
|
48
|
+
* - "6": 6-digit postal codes (3+3 format, current standard)
|
|
49
|
+
* - "3+5": Accept both 3-digit and 5-digit formats
|
|
50
|
+
* - "3+6": Accept both 3-digit and 6-digit formats (recommended)
|
|
51
|
+
* - "5+6": Accept both 5-digit and 6-digit formats
|
|
52
|
+
* - "all": Accept all formats (3, 5, and 6 digits)
|
|
53
|
+
*/
|
|
54
|
+
type TwPostalCodeFormatType = "3" | "5" | "6" | "3+5" | "3+6" | "5+6" | "all";
|
|
55
|
+
/**
|
|
56
|
+
* Configuration options for Taiwan postal code validation
|
|
57
|
+
*
|
|
58
|
+
* @template IsRequired - Whether the field is required (affects return type)
|
|
59
|
+
*
|
|
60
|
+
* @interface TwPostalCodeOptions
|
|
61
|
+
* @property {IsRequired} [required=true] - Whether the field is required
|
|
62
|
+
* @property {TwPostalCodeFormatType} [format="3+6"] - Which postal code formats to accept
|
|
63
|
+
* @property {boolean} [strictValidation=true] - Enable strict validation against known postal code ranges
|
|
64
|
+
* @property {boolean} [allowDashes=true] - Whether to allow dashes in postal codes (e.g., "100-01" or "100-001")
|
|
65
|
+
* @property {boolean} [warn5Digit=true] - Whether to show warning for 5-digit legacy format
|
|
66
|
+
* @property {string[]} [allowedPrefixes] - Specific 3-digit prefixes to allow (if strictValidation is true)
|
|
67
|
+
* @property {string[]} [blockedPrefixes] - Specific 3-digit prefixes to block
|
|
68
|
+
* @property {Function} [transform] - Custom transformation function for postal codes
|
|
69
|
+
* @property {string | null} [defaultValue] - Default value when input is empty
|
|
70
|
+
* @property {Record<Locale, TwPostalCodeMessages>} [i18n] - Custom error messages for different locales
|
|
71
|
+
*/
|
|
72
|
+
type TwPostalCodeOptions<IsRequired extends boolean = true> = {
|
|
73
|
+
format?: TwPostalCodeFormatType;
|
|
74
|
+
strictValidation?: boolean;
|
|
75
|
+
allowDashes?: boolean;
|
|
76
|
+
warn5Digit?: boolean;
|
|
77
|
+
allowedPrefixes?: string[];
|
|
78
|
+
blockedPrefixes?: string[];
|
|
79
|
+
transform?: (value: string) => string;
|
|
80
|
+
defaultValue?: IsRequired extends true ? string : string | null;
|
|
81
|
+
i18n?: Partial<Record<Locale, Partial<TwPostalCodeMessages>>>;
|
|
82
|
+
strictSuffixValidation?: boolean;
|
|
83
|
+
deprecate5Digit?: boolean;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Type alias for postal code validation schema based on required flag
|
|
87
|
+
*
|
|
88
|
+
* @template IsRequired - Whether the field is required
|
|
89
|
+
* @typedef TwPostalCodeSchema
|
|
90
|
+
* @description Returns ZodString if required, ZodNullable<ZodString> if optional
|
|
91
|
+
*/
|
|
92
|
+
type TwPostalCodeSchema<IsRequired extends boolean> = IsRequired extends true ? ZodString : ZodNullable<ZodString>;
|
|
93
|
+
/**
|
|
94
|
+
* Valid 3-digit postal code prefixes for Taiwan
|
|
95
|
+
* Based on official Chunghwa Post data (2024)
|
|
96
|
+
*/
|
|
97
|
+
declare const VALID_3_DIGIT_PREFIXES: string[];
|
|
98
|
+
/**
|
|
99
|
+
* Validates 3-digit Taiwan postal code
|
|
100
|
+
*
|
|
101
|
+
* @param {string} value - The 3-digit postal code to validate
|
|
102
|
+
* @param {boolean} strictValidation - Whether to validate against known postal code list
|
|
103
|
+
* @param {string[]} allowedPrefixes - Specific prefixes to allow (overrides strictValidation)
|
|
104
|
+
* @param {string[]} blockedPrefixes - Specific prefixes to block
|
|
105
|
+
* @returns {boolean} True if the postal code is valid
|
|
106
|
+
*/
|
|
107
|
+
declare const validate3DigitPostalCode: (value: string, strictValidation?: boolean, allowedPrefixes?: string[], blockedPrefixes?: string[]) => boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Validates 5-digit Taiwan postal code (legacy format)
|
|
110
|
+
*
|
|
111
|
+
* @param {string} value - The 5-digit postal code to validate
|
|
112
|
+
* @param {boolean} strictValidation - Whether to validate the 3-digit prefix
|
|
113
|
+
* @param {boolean} strictSuffixValidation - Whether to validate the 2-digit suffix
|
|
114
|
+
* @param {string[]} allowedPrefixes - Specific prefixes to allow
|
|
115
|
+
* @param {string[]} blockedPrefixes - Specific prefixes to block
|
|
116
|
+
* @returns {boolean} True if the postal code is valid
|
|
117
|
+
*/
|
|
118
|
+
declare const validate5DigitPostalCode: (value: string, strictValidation?: boolean, strictSuffixValidation?: boolean, allowedPrefixes?: string[], blockedPrefixes?: string[]) => boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Validates 6-digit Taiwan postal code (current format)
|
|
121
|
+
*
|
|
122
|
+
* @param {string} value - The 6-digit postal code to validate
|
|
123
|
+
* @param {boolean} strictValidation - Whether to validate the 3-digit prefix
|
|
124
|
+
* @param {boolean} strictSuffixValidation - Whether to validate the 3-digit suffix
|
|
125
|
+
* @param {string[]} allowedPrefixes - Specific prefixes to allow
|
|
126
|
+
* @param {string[]} blockedPrefixes - Specific prefixes to block
|
|
127
|
+
* @returns {boolean} True if the postal code is valid
|
|
128
|
+
*/
|
|
129
|
+
declare const validate6DigitPostalCode: (value: string, strictValidation?: boolean, strictSuffixValidation?: boolean, allowedPrefixes?: string[], blockedPrefixes?: string[]) => boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Main validation function for Taiwan postal codes
|
|
132
|
+
*
|
|
133
|
+
* @param {string} value - The postal code to validate
|
|
134
|
+
* @param {TwPostalCodeFormatType} format - Which formats to accept
|
|
135
|
+
* @param {boolean} strictValidation - Whether to validate against known postal codes
|
|
136
|
+
* @param {boolean} strictSuffixValidation - Whether to validate suffix ranges
|
|
137
|
+
* @param {boolean} allowDashes - Whether dashes/spaces are allowed and should be removed
|
|
138
|
+
* @param {string[]} allowedPrefixes - Specific prefixes to allow
|
|
139
|
+
* @param {string[]} blockedPrefixes - Specific prefixes to block
|
|
140
|
+
* @returns {boolean} True if the postal code is valid
|
|
141
|
+
*/
|
|
142
|
+
declare const validateTaiwanPostalCode: (value: string, format?: TwPostalCodeFormatType, strictValidation?: boolean, strictSuffixValidation?: boolean, allowDashes?: boolean, allowedPrefixes?: string[], blockedPrefixes?: string[]) => boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Creates a Zod schema for Taiwan postal code validation
|
|
145
|
+
*
|
|
146
|
+
* @template IsRequired - Whether the field is required (affects return type)
|
|
147
|
+
* @param {TwPostalCodeOptions<IsRequired>} [options] - Configuration options for postal code validation
|
|
148
|
+
* @returns {TwPostalCodeSchema<IsRequired>} Zod schema for postal code validation
|
|
149
|
+
*
|
|
150
|
+
* @description
|
|
151
|
+
* Creates a comprehensive Taiwan postal code validator that supports multiple formats
|
|
152
|
+
* and provides extensive configuration options for different validation scenarios.
|
|
153
|
+
*
|
|
154
|
+
* Features:
|
|
155
|
+
* - 3-digit, 5-digit, and 6-digit postal code format support
|
|
156
|
+
* - Strict validation against official postal code ranges
|
|
157
|
+
* - Legacy 5-digit format with optional warnings
|
|
158
|
+
* - Custom prefix allowlist/blocklist support
|
|
159
|
+
* - Dash and space handling in postal codes
|
|
160
|
+
* - Automatic normalization and formatting
|
|
161
|
+
* - Custom transformation functions
|
|
162
|
+
* - Comprehensive internationalization
|
|
163
|
+
* - Optional field support
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* // Accept 3-digit or 6-digit formats (recommended)
|
|
168
|
+
* const modernSchema = twPostalCode()
|
|
169
|
+
* modernSchema.parse("100") // ✓ Valid 3-digit
|
|
170
|
+
* modernSchema.parse("100001") // ✓ Valid 6-digit
|
|
171
|
+
* modernSchema.parse("10001") // ✗ Invalid (5-digit not allowed)
|
|
172
|
+
*
|
|
173
|
+
* // Accept all formats
|
|
174
|
+
* const flexibleSchema = twPostalCode(false, { format: "all" })
|
|
175
|
+
* flexibleSchema.parse("100") // ✓ Valid
|
|
176
|
+
* flexibleSchema.parse("10001") // ✓ Valid
|
|
177
|
+
* flexibleSchema.parse("100001") // ✓ Valid
|
|
178
|
+
*
|
|
179
|
+
* // Only 6-digit format (current standard)
|
|
180
|
+
* const modernOnlySchema = twPostalCode(false, { format: "6" })
|
|
181
|
+
* modernOnlySchema.parse("100001") // ✓ Valid
|
|
182
|
+
* modernOnlySchema.parse("100") // ✗ Invalid
|
|
183
|
+
*
|
|
184
|
+
* // With dashes allowed
|
|
185
|
+
* const dashSchema = twPostalCode(false, { allowDashes: true })
|
|
186
|
+
* dashSchema.parse("100-001") // ✓ Valid (normalized to "100001")
|
|
187
|
+
* dashSchema.parse("100-01") // ✓ Valid if 5-digit format allowed
|
|
188
|
+
*
|
|
189
|
+
* // Specific areas only
|
|
190
|
+
* const taipeiSchema = twPostalCode(false, {
|
|
191
|
+
* allowedPrefixes: ["100", "103", "104", "105", "106"]
|
|
192
|
+
* })
|
|
193
|
+
* taipeiSchema.parse("100001") // ✓ Valid (Taipei area)
|
|
194
|
+
* taipeiSchema.parse("200001") // ✗ Invalid (not in allowlist)
|
|
195
|
+
*
|
|
196
|
+
* // Block specific areas
|
|
197
|
+
* const blockedSchema = twPostalCode(false, {
|
|
198
|
+
* blockedPrefixes: ["999"] // Block test codes
|
|
199
|
+
* })
|
|
200
|
+
*
|
|
201
|
+
* // With warning for legacy format
|
|
202
|
+
* const warnSchema = twPostalCode(false, {
|
|
203
|
+
* format: "all",
|
|
204
|
+
* warn5Digit: true
|
|
205
|
+
* })
|
|
206
|
+
* // Will validate but may show warning for 5-digit codes
|
|
207
|
+
*
|
|
208
|
+
* // Optional with custom transformation
|
|
209
|
+
* const optionalSchema = twPostalCode(false, {
|
|
210
|
+
* transform: (value) => value.replace(/\D/g, '') // Remove non-digits
|
|
211
|
+
* })
|
|
212
|
+
*
|
|
213
|
+
* // Strict suffix validation for real postal codes
|
|
214
|
+
* const strictSchema = twPostalCode(false, {
|
|
215
|
+
* format: "6",
|
|
216
|
+
* strictSuffixValidation: true // Validates suffix range 001-999
|
|
217
|
+
* })
|
|
218
|
+
* strictSchema.parse("100001") // ✓ Valid
|
|
219
|
+
* strictSchema.parse("100000") // ✗ Invalid (suffix 000 not allowed)
|
|
220
|
+
*
|
|
221
|
+
* // Deprecate 5-digit codes entirely
|
|
222
|
+
* const modern2024Schema = twPostalCode(false, {
|
|
223
|
+
* format: "all",
|
|
224
|
+
* deprecate5Digit: true // Throws error for any 5-digit code
|
|
225
|
+
* })
|
|
226
|
+
* modern2024Schema.parse("100001") // ✓ Valid 6-digit
|
|
227
|
+
* modern2024Schema.parse("10001") // ✗ Error: deprecated format
|
|
228
|
+
* ```
|
|
229
|
+
*
|
|
230
|
+
* @throws {z.ZodError} When validation fails with specific error messages
|
|
231
|
+
* @see {@link TwPostalCodeOptions} for all available configuration options
|
|
232
|
+
* @see {@link TwPostalCodeFormatType} for supported formats
|
|
233
|
+
* @see {@link validateTaiwanPostalCode} for validation logic details
|
|
234
|
+
*/
|
|
235
|
+
declare function twPostalCode<IsRequired extends boolean = false>(required?: IsRequired, options?: Omit<TwPostalCodeOptions<IsRequired>, 'required'>): TwPostalCodeSchema<IsRequired>;
|
|
236
|
+
|
|
237
|
+
export { type TwPostalCodeFormatType, type TwPostalCodeMessages, type TwPostalCodeOptions, type TwPostalCodeSchema, VALID_3_DIGIT_PREFIXES, twPostalCode, validate3DigitPostalCode, validate5DigitPostalCode, validate6DigitPostalCode, validateTaiwanPostalCode };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VALID_3_DIGIT_PREFIXES,
|
|
3
|
+
twPostalCode,
|
|
4
|
+
validate3DigitPostalCode,
|
|
5
|
+
validate5DigitPostalCode,
|
|
6
|
+
validate6DigitPostalCode,
|
|
7
|
+
validateTaiwanPostalCode
|
|
8
|
+
} from "../chunk-H2XTEM4M.js";
|
|
9
|
+
import "../chunk-6AAP4LPF.js";
|
|
10
|
+
export {
|
|
11
|
+
VALID_3_DIGIT_PREFIXES,
|
|
12
|
+
twPostalCode,
|
|
13
|
+
validate3DigitPostalCode,
|
|
14
|
+
validate5DigitPostalCode,
|
|
15
|
+
validate6DigitPostalCode,
|
|
16
|
+
validateTaiwanPostalCode
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkVB2KV2ZMcjs = require('../chunk-VB2KV2ZM.cjs');
|
|
5
|
+
require('../chunk-UCOXAZJF.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.twTel = _chunkVB2KV2ZMcjs.twTel; exports.validateTaiwanTel = _chunkVB2KV2ZMcjs.validateTaiwanTel;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { ZodString, ZodNullable } from 'zod';
|
|
2
|
+
import { L as Locale } from '../config-CABSSvAp.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview Taiwan Landline Telephone Number validator for Zod Kit
|
|
6
|
+
*
|
|
7
|
+
* Provides validation for Taiwan landline telephone numbers according to the
|
|
8
|
+
* official 2024 telecom numbering plan with comprehensive area code support.
|
|
9
|
+
*
|
|
10
|
+
* @author Ong Hoe Yuan
|
|
11
|
+
* @version 0.0.5
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Type definition for telephone validation error messages
|
|
16
|
+
*
|
|
17
|
+
* @interface TwTelMessages
|
|
18
|
+
* @property {string} [required] - Message when field is required but empty
|
|
19
|
+
* @property {string} [invalid] - Message when telephone number format is invalid
|
|
20
|
+
* @property {string} [notInWhitelist] - Message when telephone number is not in whitelist
|
|
21
|
+
*/
|
|
22
|
+
type TwTelMessages = {
|
|
23
|
+
required?: string;
|
|
24
|
+
invalid?: string;
|
|
25
|
+
notInWhitelist?: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Configuration options for Taiwan landline telephone validation
|
|
29
|
+
*
|
|
30
|
+
* @template IsRequired - Whether the field is required (affects return type)
|
|
31
|
+
*
|
|
32
|
+
* @interface TwTelOptions
|
|
33
|
+
* @property {IsRequired} [required=true] - Whether the field is required
|
|
34
|
+
* @property {string[]} [whitelist] - Array of specific telephone numbers that are always allowed
|
|
35
|
+
* @property {Function} [transform] - Custom transformation function for telephone number
|
|
36
|
+
* @property {string | null} [defaultValue] - Default value when input is empty
|
|
37
|
+
* @property {Record<Locale, TwTelMessages>} [i18n] - Custom error messages for different locales
|
|
38
|
+
*/
|
|
39
|
+
type TwTelOptions<IsRequired extends boolean = true> = {
|
|
40
|
+
whitelist?: string[];
|
|
41
|
+
transform?: (value: string) => string;
|
|
42
|
+
defaultValue?: IsRequired extends true ? string : string | null;
|
|
43
|
+
i18n?: Partial<Record<Locale, Partial<TwTelMessages>>>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Type alias for telephone validation schema based on required flag
|
|
47
|
+
*
|
|
48
|
+
* @template IsRequired - Whether the field is required
|
|
49
|
+
* @typedef TwTelSchema
|
|
50
|
+
* @description Returns ZodString if required, ZodNullable<ZodString> if optional
|
|
51
|
+
*/
|
|
52
|
+
type TwTelSchema<IsRequired extends boolean> = IsRequired extends true ? ZodString : ZodNullable<ZodString>;
|
|
53
|
+
/**
|
|
54
|
+
* Validates Taiwan landline telephone number format (Official 2024 rules)
|
|
55
|
+
*
|
|
56
|
+
* @param {string} value - The telephone number to validate
|
|
57
|
+
* @returns {boolean} True if the telephone number is valid
|
|
58
|
+
*
|
|
59
|
+
* @description
|
|
60
|
+
* Validates Taiwan landline telephone numbers according to the official 2024
|
|
61
|
+
* telecom numbering plan. Supports all Taiwan area codes and their specific
|
|
62
|
+
* number patterns.
|
|
63
|
+
*
|
|
64
|
+
* Supported area codes and formats:
|
|
65
|
+
* - 02: Taipei, New Taipei, Keelung - 8 digits
|
|
66
|
+
* - 03: Taoyuan, Hsinchu, Yilan, Hualien - 7-8 digits
|
|
67
|
+
* - 037: Miaoli - 6-7 digits
|
|
68
|
+
* - 04: Taichung, Changhua, Nantou - 7-8 digits
|
|
69
|
+
* - 049: Nantou - 6-7 digits
|
|
70
|
+
* - 05: Yunlin, Chiayi - 7 digits
|
|
71
|
+
* - 06: Tainan - 7 digits
|
|
72
|
+
* - 07: Kaohsiung - 7-8 digits
|
|
73
|
+
* - 08: Pingtung - 7 digits
|
|
74
|
+
* - 0800: Toll-free - 6 digits
|
|
75
|
+
* - 0809: Toll-free - 6 digits
|
|
76
|
+
* - 082: Kinmen - 6 digits
|
|
77
|
+
* - 0836: Matsu - 5-6 digits
|
|
78
|
+
* - 089: Taitung - 6 digits
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* validateTaiwanTel("0223456789") // true (Taipei area)
|
|
83
|
+
* validateTaiwanTel("0423288882") // true (Taichung area, 8 digits)
|
|
84
|
+
* validateTaiwanTel("037234567") // true (Miaoli area)
|
|
85
|
+
* validateTaiwanTel("082234567") // true (Kinmen area)
|
|
86
|
+
* validateTaiwanTel("02-2345-6789") // true (with separators)
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
declare const validateTaiwanTel: (value: string) => boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Creates a Zod schema for Taiwan landline telephone number validation
|
|
92
|
+
*
|
|
93
|
+
* @template IsRequired - Whether the field is required (affects return type)
|
|
94
|
+
* @param {IsRequired} [required=false] - Whether the field is required
|
|
95
|
+
* @param {Omit<ValidatorOptions<IsRequired>, 'required'>} [options] - Configuration options for validation
|
|
96
|
+
* @returns {TwTelSchema<IsRequired>} Zod schema for telephone number validation
|
|
97
|
+
*
|
|
98
|
+
* @description
|
|
99
|
+
* Creates a comprehensive Taiwan landline telephone number validator with support for
|
|
100
|
+
* all Taiwan area codes according to the official 2024 telecom numbering plan.
|
|
101
|
+
*
|
|
102
|
+
* Features:
|
|
103
|
+
* - Complete Taiwan area code support (02, 03, 037, 04, 049, 05, 06, 07, 08, 082, 0826, 0836, 089)
|
|
104
|
+
* - Automatic separator handling (hyphens and spaces)
|
|
105
|
+
* - Area-specific number length and pattern validation
|
|
106
|
+
* - Whitelist functionality for specific allowed numbers
|
|
107
|
+
* - Automatic trimming and preprocessing
|
|
108
|
+
* - Custom transformation functions
|
|
109
|
+
* - Comprehensive internationalization
|
|
110
|
+
* - Optional field support
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* // Basic telephone number validation
|
|
115
|
+
* const basicSchema = twTel() // optional by default
|
|
116
|
+
* basicSchema.parse("0223456789") // ✓ Valid (Taipei)
|
|
117
|
+
* basicSchema.parse(null) // ✓ Valid (optional)
|
|
118
|
+
*
|
|
119
|
+
* // Required validation
|
|
120
|
+
* const requiredSchema = parse("0223456789") // ✓ Valid (Taipei)
|
|
121
|
+
(true)
|
|
122
|
+
* requiredSchema.parse(null) // ✗ Invalid (required)
|
|
123
|
+
*
|
|
124
|
+
* basicSchema.parse("0312345678") // ✓ Valid (Taoyuan)
|
|
125
|
+
* basicSchema.parse("02-2345-6789") // ✓ Valid (with separators)
|
|
126
|
+
* basicSchema.parse("0812345678") // ✗ Invalid (wrong format for 08)
|
|
127
|
+
*
|
|
128
|
+
* // With whitelist (only specific numbers allowed)
|
|
129
|
+
* const whitelistSchema = twTel(false, {
|
|
130
|
+
* whitelist: ["0223456789", "0312345678"]
|
|
131
|
+
* })
|
|
132
|
+
* whitelistSchema.parse("0223456789") // ✓ Valid (in whitelist)
|
|
133
|
+
* whitelistSchema.parse("0287654321") // ✗ Invalid (not in whitelist)
|
|
134
|
+
*
|
|
135
|
+
* // Optional telephone number
|
|
136
|
+
* const optionalSchema = twTel(false)
|
|
137
|
+
* optionalSchema.parse("") // ✓ Valid (returns null)
|
|
138
|
+
* optionalSchema.parse("0223456789") // ✓ Valid
|
|
139
|
+
*
|
|
140
|
+
* // With custom transformation (remove separators)
|
|
141
|
+
* const transformSchema = twTel(false, {
|
|
142
|
+
* transform: (value) => value.replace(/[^0-9]/g, '') // Keep only digits
|
|
143
|
+
* })
|
|
144
|
+
* transformSchema.parse("02-2345-6789") // ✓ Valid (separators removed)
|
|
145
|
+
* transformSchema.parse("02 2345 6789") // ✓ Valid (spaces removed)
|
|
146
|
+
*
|
|
147
|
+
* // With custom error messages
|
|
148
|
+
* const customSchema = twTel(false, {
|
|
149
|
+
* i18n: {
|
|
150
|
+
* en: { invalid: "Please enter a valid Taiwan landline number" },
|
|
151
|
+
* 'zh-TW': { invalid: "請輸入有效的台灣市話號碼" }
|
|
152
|
+
* }
|
|
153
|
+
* })
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @throws {z.ZodError} When validation fails with specific error messages
|
|
157
|
+
* @see {@link TwTelOptions} for all available configuration options
|
|
158
|
+
* @see {@link validateTaiwanTel} for validation logic details
|
|
159
|
+
*/
|
|
160
|
+
declare function twTel<IsRequired extends boolean = false>(required?: IsRequired, options?: Omit<TwTelOptions<IsRequired>, 'required'>): TwTelSchema<IsRequired>;
|
|
161
|
+
|
|
162
|
+
export { type TwTelMessages, type TwTelOptions, type TwTelSchema, twTel, validateTaiwanTel };
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { ZodString, ZodNullable } from 'zod';
|
|
2
|
+
import { L as Locale } from '../config-CABSSvAp.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview Taiwan Landline Telephone Number validator for Zod Kit
|
|
6
|
+
*
|
|
7
|
+
* Provides validation for Taiwan landline telephone numbers according to the
|
|
8
|
+
* official 2024 telecom numbering plan with comprehensive area code support.
|
|
9
|
+
*
|
|
10
|
+
* @author Ong Hoe Yuan
|
|
11
|
+
* @version 0.0.5
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Type definition for telephone validation error messages
|
|
16
|
+
*
|
|
17
|
+
* @interface TwTelMessages
|
|
18
|
+
* @property {string} [required] - Message when field is required but empty
|
|
19
|
+
* @property {string} [invalid] - Message when telephone number format is invalid
|
|
20
|
+
* @property {string} [notInWhitelist] - Message when telephone number is not in whitelist
|
|
21
|
+
*/
|
|
22
|
+
type TwTelMessages = {
|
|
23
|
+
required?: string;
|
|
24
|
+
invalid?: string;
|
|
25
|
+
notInWhitelist?: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Configuration options for Taiwan landline telephone validation
|
|
29
|
+
*
|
|
30
|
+
* @template IsRequired - Whether the field is required (affects return type)
|
|
31
|
+
*
|
|
32
|
+
* @interface TwTelOptions
|
|
33
|
+
* @property {IsRequired} [required=true] - Whether the field is required
|
|
34
|
+
* @property {string[]} [whitelist] - Array of specific telephone numbers that are always allowed
|
|
35
|
+
* @property {Function} [transform] - Custom transformation function for telephone number
|
|
36
|
+
* @property {string | null} [defaultValue] - Default value when input is empty
|
|
37
|
+
* @property {Record<Locale, TwTelMessages>} [i18n] - Custom error messages for different locales
|
|
38
|
+
*/
|
|
39
|
+
type TwTelOptions<IsRequired extends boolean = true> = {
|
|
40
|
+
whitelist?: string[];
|
|
41
|
+
transform?: (value: string) => string;
|
|
42
|
+
defaultValue?: IsRequired extends true ? string : string | null;
|
|
43
|
+
i18n?: Partial<Record<Locale, Partial<TwTelMessages>>>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Type alias for telephone validation schema based on required flag
|
|
47
|
+
*
|
|
48
|
+
* @template IsRequired - Whether the field is required
|
|
49
|
+
* @typedef TwTelSchema
|
|
50
|
+
* @description Returns ZodString if required, ZodNullable<ZodString> if optional
|
|
51
|
+
*/
|
|
52
|
+
type TwTelSchema<IsRequired extends boolean> = IsRequired extends true ? ZodString : ZodNullable<ZodString>;
|
|
53
|
+
/**
|
|
54
|
+
* Validates Taiwan landline telephone number format (Official 2024 rules)
|
|
55
|
+
*
|
|
56
|
+
* @param {string} value - The telephone number to validate
|
|
57
|
+
* @returns {boolean} True if the telephone number is valid
|
|
58
|
+
*
|
|
59
|
+
* @description
|
|
60
|
+
* Validates Taiwan landline telephone numbers according to the official 2024
|
|
61
|
+
* telecom numbering plan. Supports all Taiwan area codes and their specific
|
|
62
|
+
* number patterns.
|
|
63
|
+
*
|
|
64
|
+
* Supported area codes and formats:
|
|
65
|
+
* - 02: Taipei, New Taipei, Keelung - 8 digits
|
|
66
|
+
* - 03: Taoyuan, Hsinchu, Yilan, Hualien - 7-8 digits
|
|
67
|
+
* - 037: Miaoli - 6-7 digits
|
|
68
|
+
* - 04: Taichung, Changhua, Nantou - 7-8 digits
|
|
69
|
+
* - 049: Nantou - 6-7 digits
|
|
70
|
+
* - 05: Yunlin, Chiayi - 7 digits
|
|
71
|
+
* - 06: Tainan - 7 digits
|
|
72
|
+
* - 07: Kaohsiung - 7-8 digits
|
|
73
|
+
* - 08: Pingtung - 7 digits
|
|
74
|
+
* - 0800: Toll-free - 6 digits
|
|
75
|
+
* - 0809: Toll-free - 6 digits
|
|
76
|
+
* - 082: Kinmen - 6 digits
|
|
77
|
+
* - 0836: Matsu - 5-6 digits
|
|
78
|
+
* - 089: Taitung - 6 digits
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* validateTaiwanTel("0223456789") // true (Taipei area)
|
|
83
|
+
* validateTaiwanTel("0423288882") // true (Taichung area, 8 digits)
|
|
84
|
+
* validateTaiwanTel("037234567") // true (Miaoli area)
|
|
85
|
+
* validateTaiwanTel("082234567") // true (Kinmen area)
|
|
86
|
+
* validateTaiwanTel("02-2345-6789") // true (with separators)
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
declare const validateTaiwanTel: (value: string) => boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Creates a Zod schema for Taiwan landline telephone number validation
|
|
92
|
+
*
|
|
93
|
+
* @template IsRequired - Whether the field is required (affects return type)
|
|
94
|
+
* @param {IsRequired} [required=false] - Whether the field is required
|
|
95
|
+
* @param {Omit<ValidatorOptions<IsRequired>, 'required'>} [options] - Configuration options for validation
|
|
96
|
+
* @returns {TwTelSchema<IsRequired>} Zod schema for telephone number validation
|
|
97
|
+
*
|
|
98
|
+
* @description
|
|
99
|
+
* Creates a comprehensive Taiwan landline telephone number validator with support for
|
|
100
|
+
* all Taiwan area codes according to the official 2024 telecom numbering plan.
|
|
101
|
+
*
|
|
102
|
+
* Features:
|
|
103
|
+
* - Complete Taiwan area code support (02, 03, 037, 04, 049, 05, 06, 07, 08, 082, 0826, 0836, 089)
|
|
104
|
+
* - Automatic separator handling (hyphens and spaces)
|
|
105
|
+
* - Area-specific number length and pattern validation
|
|
106
|
+
* - Whitelist functionality for specific allowed numbers
|
|
107
|
+
* - Automatic trimming and preprocessing
|
|
108
|
+
* - Custom transformation functions
|
|
109
|
+
* - Comprehensive internationalization
|
|
110
|
+
* - Optional field support
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* // Basic telephone number validation
|
|
115
|
+
* const basicSchema = twTel() // optional by default
|
|
116
|
+
* basicSchema.parse("0223456789") // ✓ Valid (Taipei)
|
|
117
|
+
* basicSchema.parse(null) // ✓ Valid (optional)
|
|
118
|
+
*
|
|
119
|
+
* // Required validation
|
|
120
|
+
* const requiredSchema = parse("0223456789") // ✓ Valid (Taipei)
|
|
121
|
+
(true)
|
|
122
|
+
* requiredSchema.parse(null) // ✗ Invalid (required)
|
|
123
|
+
*
|
|
124
|
+
* basicSchema.parse("0312345678") // ✓ Valid (Taoyuan)
|
|
125
|
+
* basicSchema.parse("02-2345-6789") // ✓ Valid (with separators)
|
|
126
|
+
* basicSchema.parse("0812345678") // ✗ Invalid (wrong format for 08)
|
|
127
|
+
*
|
|
128
|
+
* // With whitelist (only specific numbers allowed)
|
|
129
|
+
* const whitelistSchema = twTel(false, {
|
|
130
|
+
* whitelist: ["0223456789", "0312345678"]
|
|
131
|
+
* })
|
|
132
|
+
* whitelistSchema.parse("0223456789") // ✓ Valid (in whitelist)
|
|
133
|
+
* whitelistSchema.parse("0287654321") // ✗ Invalid (not in whitelist)
|
|
134
|
+
*
|
|
135
|
+
* // Optional telephone number
|
|
136
|
+
* const optionalSchema = twTel(false)
|
|
137
|
+
* optionalSchema.parse("") // ✓ Valid (returns null)
|
|
138
|
+
* optionalSchema.parse("0223456789") // ✓ Valid
|
|
139
|
+
*
|
|
140
|
+
* // With custom transformation (remove separators)
|
|
141
|
+
* const transformSchema = twTel(false, {
|
|
142
|
+
* transform: (value) => value.replace(/[^0-9]/g, '') // Keep only digits
|
|
143
|
+
* })
|
|
144
|
+
* transformSchema.parse("02-2345-6789") // ✓ Valid (separators removed)
|
|
145
|
+
* transformSchema.parse("02 2345 6789") // ✓ Valid (spaces removed)
|
|
146
|
+
*
|
|
147
|
+
* // With custom error messages
|
|
148
|
+
* const customSchema = twTel(false, {
|
|
149
|
+
* i18n: {
|
|
150
|
+
* en: { invalid: "Please enter a valid Taiwan landline number" },
|
|
151
|
+
* 'zh-TW': { invalid: "請輸入有效的台灣市話號碼" }
|
|
152
|
+
* }
|
|
153
|
+
* })
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @throws {z.ZodError} When validation fails with specific error messages
|
|
157
|
+
* @see {@link TwTelOptions} for all available configuration options
|
|
158
|
+
* @see {@link validateTaiwanTel} for validation logic details
|
|
159
|
+
*/
|
|
160
|
+
declare function twTel<IsRequired extends boolean = false>(required?: IsRequired, options?: Omit<TwTelOptions<IsRequired>, 'required'>): TwTelSchema<IsRequired>;
|
|
161
|
+
|
|
162
|
+
export { type TwTelMessages, type TwTelOptions, type TwTelSchema, twTel, validateTaiwanTel };
|