@hy_ong/zod-kit 0.2.8 → 0.2.9

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.
Files changed (37) hide show
  1. package/README.md +50 -51
  2. package/dist/{chunk-U2PB6XEO.js → chunk-2XLAXQGM.js} +43 -1
  3. package/dist/{chunk-KIUO2HIR.cjs → chunk-3GAFULXI.cjs} +15 -3
  4. package/dist/{chunk-RHKBT3M2.js → chunk-B6XAA3UV.js} +7 -7
  5. package/dist/{chunk-4AQB4RSU.cjs → chunk-FVWOLTP6.cjs} +10 -10
  6. package/dist/{chunk-TDEXEIHH.cjs → chunk-IFSUPBIF.cjs} +43 -1
  7. package/dist/{chunk-ADKXVZHH.js → chunk-IZEVVOXI.js} +17 -4
  8. package/dist/{chunk-OGU7AIZF.js → chunk-LUFTQDGA.js} +15 -3
  9. package/dist/{chunk-53EEWALQ.cjs → chunk-NLEKGYTV.cjs} +14 -14
  10. package/dist/{chunk-RVGCMQ4J.js → chunk-S5N6EFNB.js} +5 -5
  11. package/dist/{chunk-7EUHTSMF.cjs → chunk-SFJZLW6P.cjs} +18 -5
  12. package/dist/common/date.cjs +2 -2
  13. package/dist/common/date.js +1 -1
  14. package/dist/common/datetime.cjs +2 -2
  15. package/dist/common/datetime.js +1 -1
  16. package/dist/common/file.cjs +2 -2
  17. package/dist/common/file.js +1 -1
  18. package/dist/common/url.cjs +2 -2
  19. package/dist/common/url.js +1 -1
  20. package/dist/index.cjs +8 -6
  21. package/dist/index.d.cts +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +7 -5
  24. package/dist/taiwan/tel.cjs +4 -2
  25. package/dist/taiwan/tel.d.cts +40 -15
  26. package/dist/taiwan/tel.d.ts +40 -15
  27. package/dist/taiwan/tel.js +3 -1
  28. package/package.json +10 -10
  29. package/src/validators/common/date.ts +5 -5
  30. package/src/validators/common/datetime.ts +7 -7
  31. package/src/validators/common/file.ts +19 -3
  32. package/src/validators/common/url.ts +76 -1
  33. package/src/validators/taiwan/tel.ts +63 -20
  34. package/tests/common/file.test.ts +20 -0
  35. package/tests/common/url.test.ts +18 -0
  36. package/tests/taiwan/tel.test.ts +39 -5
  37. package/tsconfig.json +2 -1
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunk53EEWALQcjs = require('../chunk-53EEWALQ.cjs');
7
+ var _chunkNLEKGYTVcjs = require('../chunk-NLEKGYTV.cjs');
8
8
  require('../chunk-Q7TUNJD4.cjs');
9
9
 
10
10
 
@@ -12,4 +12,4 @@ require('../chunk-Q7TUNJD4.cjs');
12
12
 
13
13
 
14
14
 
15
- exports.DATETIME_PATTERNS = _chunk53EEWALQcjs.DATETIME_PATTERNS; exports.datetime = _chunk53EEWALQcjs.datetime; exports.normalizeDateTimeValue = _chunk53EEWALQcjs.normalizeDateTimeValue; exports.parseDateTimeValue = _chunk53EEWALQcjs.parseDateTimeValue; exports.validateDateTimeFormat = _chunk53EEWALQcjs.validateDateTimeFormat;
15
+ exports.DATETIME_PATTERNS = _chunkNLEKGYTVcjs.DATETIME_PATTERNS; exports.datetime = _chunkNLEKGYTVcjs.datetime; exports.normalizeDateTimeValue = _chunkNLEKGYTVcjs.normalizeDateTimeValue; exports.parseDateTimeValue = _chunkNLEKGYTVcjs.parseDateTimeValue; exports.validateDateTimeFormat = _chunkNLEKGYTVcjs.validateDateTimeFormat;
@@ -4,7 +4,7 @@ import {
4
4
  normalizeDateTimeValue,
5
5
  parseDateTimeValue,
6
6
  validateDateTimeFormat
7
- } from "../chunk-RHKBT3M2.js";
7
+ } from "../chunk-B6XAA3UV.js";
8
8
  import "../chunk-POIDES2L.js";
9
9
  export {
10
10
  DATETIME_PATTERNS,
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkKIUO2HIRcjs = require('../chunk-KIUO2HIR.cjs');
3
+ var _chunk3GAFULXIcjs = require('../chunk-3GAFULXI.cjs');
4
4
  require('../chunk-Q7TUNJD4.cjs');
5
5
 
6
6
 
7
- exports.file = _chunkKIUO2HIRcjs.file;
7
+ exports.file = _chunk3GAFULXIcjs.file;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  file
3
- } from "../chunk-OGU7AIZF.js";
3
+ } from "../chunk-LUFTQDGA.js";
4
4
  import "../chunk-POIDES2L.js";
5
5
  export {
6
6
  file
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkTDEXEIHHcjs = require('../chunk-TDEXEIHH.cjs');
3
+ var _chunkIFSUPBIFcjs = require('../chunk-IFSUPBIF.cjs');
4
4
  require('../chunk-Q7TUNJD4.cjs');
5
5
 
6
6
 
7
- exports.url = _chunkTDEXEIHHcjs.url;
7
+ exports.url = _chunkIFSUPBIFcjs.url;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  url
3
- } from "../chunk-U2PB6XEO.js";
3
+ } from "../chunk-2XLAXQGM.js";
4
4
  import "../chunk-POIDES2L.js";
5
5
  export {
6
6
  url
package/dist/index.cjs CHANGED
@@ -50,7 +50,8 @@ var _chunkFP4O2ICMcjs = require('./chunk-FP4O2ICM.cjs');
50
50
 
51
51
 
52
52
 
53
- var _chunk7EUHTSMFcjs = require('./chunk-7EUHTSMF.cjs');
53
+
54
+ var _chunkSFJZLW6Pcjs = require('./chunk-SFJZLW6P.cjs');
54
55
 
55
56
 
56
57
 
@@ -76,7 +77,7 @@ var _chunkHZ2WESSLcjs = require('./chunk-HZ2WESSL.cjs');
76
77
  var _chunkEDTNS2XLcjs = require('./chunk-EDTNS2XL.cjs');
77
78
 
78
79
 
79
- var _chunkTDEXEIHHcjs = require('./chunk-TDEXEIHH.cjs');
80
+ var _chunkIFSUPBIFcjs = require('./chunk-IFSUPBIF.cjs');
80
81
 
81
82
 
82
83
 
@@ -92,20 +93,20 @@ var _chunkLXFRQLH4cjs = require('./chunk-LXFRQLH4.cjs');
92
93
  var _chunkLNWEJED7cjs = require('./chunk-LNWEJED7.cjs');
93
94
 
94
95
 
95
- var _chunk4AQB4RSUcjs = require('./chunk-4AQB4RSU.cjs');
96
+ var _chunkFVWOLTP6cjs = require('./chunk-FVWOLTP6.cjs');
96
97
 
97
98
 
98
99
 
99
100
 
100
101
 
101
102
 
102
- var _chunk53EEWALQcjs = require('./chunk-53EEWALQ.cjs');
103
+ var _chunkNLEKGYTVcjs = require('./chunk-NLEKGYTV.cjs');
103
104
 
104
105
 
105
106
  var _chunkH25N5GP6cjs = require('./chunk-H25N5GP6.cjs');
106
107
 
107
108
 
108
- var _chunkKIUO2HIRcjs = require('./chunk-KIUO2HIR.cjs');
109
+ var _chunk3GAFULXIcjs = require('./chunk-3GAFULXI.cjs');
109
110
 
110
111
 
111
112
 
@@ -185,4 +186,5 @@ var _chunkQ7TUNJD4cjs = require('./chunk-Q7TUNJD4.cjs');
185
186
 
186
187
 
187
188
 
188
- exports.DATETIME_PATTERNS = _chunk53EEWALQcjs.DATETIME_PATTERNS; exports.ID_PATTERNS = _chunkJZEF5Q3Wcjs.ID_PATTERNS; exports.TAIWAN_BANK_CODES = _chunkQQWX3ICKcjs.TAIWAN_BANK_CODES; exports.TIME_PATTERNS = _chunkEDTNS2XLcjs.TIME_PATTERNS; exports.VALID_3_DIGIT_PREFIXES = _chunkFP4O2ICMcjs.VALID_3_DIGIT_PREFIXES; exports.boolean = _chunkLNWEJED7cjs.boolean; exports.color = _chunkA2GAEU4Ocjs.color; exports.coordinate = _chunkFEL432I2cjs.coordinate; exports.creditCard = _chunkZCX22PY4cjs.creditCard; exports.date = _chunk4AQB4RSUcjs.date; exports.datetime = _chunk53EEWALQcjs.datetime; exports.detectCardType = _chunkZCX22PY4cjs.detectCardType; exports.detectIdType = _chunkJZEF5Q3Wcjs.detectIdType; exports.email = _chunkH25N5GP6cjs.email; exports.file = _chunkKIUO2HIRcjs.file; exports.getLocale = _chunkQ7TUNJD4cjs.getLocale; exports.id = _chunkJZEF5Q3Wcjs.id; exports.ip = _chunkLXFRQLH4cjs.ip; exports.manyOf = _chunk5U5ERV2Pcjs.manyOf; exports.normalizeDateTimeValue = _chunk53EEWALQcjs.normalizeDateTimeValue; exports.normalizeTime = _chunkEDTNS2XLcjs.normalizeTime; exports.number = _chunkG747FHUZcjs.number; exports.oneOf = _chunk5NBWPAHCcjs.oneOf; exports.parseDateTimeValue = _chunk53EEWALQcjs.parseDateTimeValue; exports.parseTimeToMinutes = _chunkEDTNS2XLcjs.parseTimeToMinutes; exports.password = _chunkQ24GYUTOcjs.password; exports.setLocale = _chunkQ7TUNJD4cjs.setLocale; exports.text = _chunkHZ2WESSLcjs.text; exports.time = _chunkEDTNS2XLcjs.time; exports.twBankAccount = _chunkQQWX3ICKcjs.twBankAccount; exports.twBusinessId = _chunkIWR3H7IHcjs.twBusinessId; exports.twFax = _chunkBZSPJJYTcjs.twFax; exports.twInvoice = _chunkV2KKGSKQcjs.twInvoice; exports.twLicensePlate = _chunkTPXRQT2Hcjs.twLicensePlate; exports.twMobile = _chunkAYCXAJRAcjs.twMobile; exports.twNationalId = _chunkUCPKW43Kcjs.twNationalId; exports.twPassport = _chunk5ZMTAI4Gcjs.twPassport; exports.twPostalCode = _chunkFP4O2ICMcjs.twPostalCode; exports.twTel = _chunk7EUHTSMFcjs.twTel; exports.url = _chunkTDEXEIHHcjs.url; exports.validate3DigitPostalCode = _chunkFP4O2ICMcjs.validate3DigitPostalCode; exports.validate5DigitPostalCode = _chunkFP4O2ICMcjs.validate5DigitPostalCode; exports.validate6DigitPostalCode = _chunkFP4O2ICMcjs.validate6DigitPostalCode; exports.validateCitizenId = _chunkUCPKW43Kcjs.validateCitizenId; exports.validateColor = _chunkA2GAEU4Ocjs.validateColor; exports.validateCreditCard = _chunkZCX22PY4cjs.validateCreditCard; exports.validateDateTimeFormat = _chunk53EEWALQcjs.validateDateTimeFormat; exports.validateIPv4 = _chunkLXFRQLH4cjs.validateIPv4; exports.validateIPv6 = _chunkLXFRQLH4cjs.validateIPv6; exports.validateIdType = _chunkJZEF5Q3Wcjs.validateIdType; exports.validateLatitude = _chunkFEL432I2cjs.validateLatitude; exports.validateLongitude = _chunkFEL432I2cjs.validateLongitude; exports.validateNewResidentId = _chunkUCPKW43Kcjs.validateNewResidentId; exports.validateOldResidentId = _chunkUCPKW43Kcjs.validateOldResidentId; exports.validateTaiwanBankAccount = _chunkQQWX3ICKcjs.validateTaiwanBankAccount; exports.validateTaiwanBusinessId = _chunkIWR3H7IHcjs.validateTaiwanBusinessId; exports.validateTaiwanFax = _chunkBZSPJJYTcjs.validateTaiwanFax; exports.validateTaiwanInvoice = _chunkV2KKGSKQcjs.validateTaiwanInvoice; exports.validateTaiwanLicensePlate = _chunkTPXRQT2Hcjs.validateTaiwanLicensePlate; exports.validateTaiwanMobile = _chunkAYCXAJRAcjs.validateTaiwanMobile; exports.validateTaiwanNationalId = _chunkUCPKW43Kcjs.validateTaiwanNationalId; exports.validateTaiwanPassport = _chunk5ZMTAI4Gcjs.validateTaiwanPassport; exports.validateTaiwanPostalCode = _chunkFP4O2ICMcjs.validateTaiwanPostalCode; exports.validateTaiwanTel = _chunk7EUHTSMFcjs.validateTaiwanTel; exports.validateTimeFormat = _chunkEDTNS2XLcjs.validateTimeFormat;
189
+
190
+ exports.DATETIME_PATTERNS = _chunkNLEKGYTVcjs.DATETIME_PATTERNS; exports.ID_PATTERNS = _chunkJZEF5Q3Wcjs.ID_PATTERNS; exports.TAIWAN_BANK_CODES = _chunkQQWX3ICKcjs.TAIWAN_BANK_CODES; exports.TIME_PATTERNS = _chunkEDTNS2XLcjs.TIME_PATTERNS; exports.VALID_3_DIGIT_PREFIXES = _chunkFP4O2ICMcjs.VALID_3_DIGIT_PREFIXES; exports.boolean = _chunkLNWEJED7cjs.boolean; exports.color = _chunkA2GAEU4Ocjs.color; exports.coordinate = _chunkFEL432I2cjs.coordinate; exports.creditCard = _chunkZCX22PY4cjs.creditCard; exports.date = _chunkFVWOLTP6cjs.date; exports.datetime = _chunkNLEKGYTVcjs.datetime; exports.detectCardType = _chunkZCX22PY4cjs.detectCardType; exports.detectIdType = _chunkJZEF5Q3Wcjs.detectIdType; exports.email = _chunkH25N5GP6cjs.email; exports.file = _chunk3GAFULXIcjs.file; exports.getLocale = _chunkQ7TUNJD4cjs.getLocale; exports.id = _chunkJZEF5Q3Wcjs.id; exports.ip = _chunkLXFRQLH4cjs.ip; exports.manyOf = _chunk5U5ERV2Pcjs.manyOf; exports.normalizeDateTimeValue = _chunkNLEKGYTVcjs.normalizeDateTimeValue; exports.normalizeTime = _chunkEDTNS2XLcjs.normalizeTime; exports.number = _chunkG747FHUZcjs.number; exports.oneOf = _chunk5NBWPAHCcjs.oneOf; exports.parseDateTimeValue = _chunkNLEKGYTVcjs.parseDateTimeValue; exports.parseTimeToMinutes = _chunkEDTNS2XLcjs.parseTimeToMinutes; exports.password = _chunkQ24GYUTOcjs.password; exports.setLocale = _chunkQ7TUNJD4cjs.setLocale; exports.text = _chunkHZ2WESSLcjs.text; exports.time = _chunkEDTNS2XLcjs.time; exports.twBankAccount = _chunkQQWX3ICKcjs.twBankAccount; exports.twBusinessId = _chunkIWR3H7IHcjs.twBusinessId; exports.twFax = _chunkBZSPJJYTcjs.twFax; exports.twInvoice = _chunkV2KKGSKQcjs.twInvoice; exports.twLicensePlate = _chunkTPXRQT2Hcjs.twLicensePlate; exports.twMobile = _chunkAYCXAJRAcjs.twMobile; exports.twNationalId = _chunkUCPKW43Kcjs.twNationalId; exports.twPassport = _chunk5ZMTAI4Gcjs.twPassport; exports.twPostalCode = _chunkFP4O2ICMcjs.twPostalCode; exports.twTel = _chunkSFJZLW6Pcjs.twTel; exports.url = _chunkIFSUPBIFcjs.url; exports.validate3DigitPostalCode = _chunkFP4O2ICMcjs.validate3DigitPostalCode; exports.validate5DigitPostalCode = _chunkFP4O2ICMcjs.validate5DigitPostalCode; exports.validate6DigitPostalCode = _chunkFP4O2ICMcjs.validate6DigitPostalCode; exports.validateCitizenId = _chunkUCPKW43Kcjs.validateCitizenId; exports.validateColor = _chunkA2GAEU4Ocjs.validateColor; exports.validateCreditCard = _chunkZCX22PY4cjs.validateCreditCard; exports.validateDateTimeFormat = _chunkNLEKGYTVcjs.validateDateTimeFormat; exports.validateIPv4 = _chunkLXFRQLH4cjs.validateIPv4; exports.validateIPv6 = _chunkLXFRQLH4cjs.validateIPv6; exports.validateIdType = _chunkJZEF5Q3Wcjs.validateIdType; exports.validateLatitude = _chunkFEL432I2cjs.validateLatitude; exports.validateLongitude = _chunkFEL432I2cjs.validateLongitude; exports.validateNewResidentId = _chunkUCPKW43Kcjs.validateNewResidentId; exports.validateOldResidentId = _chunkUCPKW43Kcjs.validateOldResidentId; exports.validateTaiwanBankAccount = _chunkQQWX3ICKcjs.validateTaiwanBankAccount; exports.validateTaiwanBusinessId = _chunkIWR3H7IHcjs.validateTaiwanBusinessId; exports.validateTaiwanFax = _chunkBZSPJJYTcjs.validateTaiwanFax; exports.validateTaiwanInternationalTollFree = _chunkSFJZLW6Pcjs.validateTaiwanInternationalTollFree; exports.validateTaiwanInvoice = _chunkV2KKGSKQcjs.validateTaiwanInvoice; exports.validateTaiwanLicensePlate = _chunkTPXRQT2Hcjs.validateTaiwanLicensePlate; exports.validateTaiwanMobile = _chunkAYCXAJRAcjs.validateTaiwanMobile; exports.validateTaiwanNationalId = _chunkUCPKW43Kcjs.validateTaiwanNationalId; exports.validateTaiwanPassport = _chunk5ZMTAI4Gcjs.validateTaiwanPassport; exports.validateTaiwanPostalCode = _chunkFP4O2ICMcjs.validateTaiwanPostalCode; exports.validateTaiwanTel = _chunkSFJZLW6Pcjs.validateTaiwanTel; exports.validateTimeFormat = _chunkEDTNS2XLcjs.validateTimeFormat;
package/dist/index.d.cts CHANGED
@@ -24,7 +24,7 @@ export { TwMobileMessages, TwMobileOptions, TwMobileSchema, twMobile, validateTa
24
24
  export { NationalIdType, TwNationalIdMessages, TwNationalIdOptions, TwNationalIdSchema, twNationalId, validateCitizenId, validateNewResidentId, validateOldResidentId, validateTaiwanNationalId } from './taiwan/national-id.cjs';
25
25
  export { PassportType, TwPassportMessages, TwPassportOptions, TwPassportSchema, twPassport, validateTaiwanPassport } from './taiwan/passport.cjs';
26
26
  export { TwPostalCodeFormatType, TwPostalCodeMessages, TwPostalCodeOptions, TwPostalCodeSchema, VALID_3_DIGIT_PREFIXES, twPostalCode, validate3DigitPostalCode, validate5DigitPostalCode, validate6DigitPostalCode, validateTaiwanPostalCode } from './taiwan/postal-code.cjs';
27
- export { TwTelMessages, TwTelOptions, TwTelSchema, twTel, validateTaiwanTel } from './taiwan/tel.cjs';
27
+ export { TwTelMessages, TwTelOptions, TwTelSchema, ValidateTaiwanTelOptions, twTel, validateTaiwanInternationalTollFree, validateTaiwanTel } from './taiwan/tel.cjs';
28
28
  export { L as Locale, g as getLocale, s as setLocale } from './config-CABSSvAp.cjs';
29
29
  import 'zod';
30
30
  import 'dayjs';
package/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ export { TwMobileMessages, TwMobileOptions, TwMobileSchema, twMobile, validateTa
24
24
  export { NationalIdType, TwNationalIdMessages, TwNationalIdOptions, TwNationalIdSchema, twNationalId, validateCitizenId, validateNewResidentId, validateOldResidentId, validateTaiwanNationalId } from './taiwan/national-id.js';
25
25
  export { PassportType, TwPassportMessages, TwPassportOptions, TwPassportSchema, twPassport, validateTaiwanPassport } from './taiwan/passport.js';
26
26
  export { TwPostalCodeFormatType, TwPostalCodeMessages, TwPostalCodeOptions, TwPostalCodeSchema, VALID_3_DIGIT_PREFIXES, twPostalCode, validate3DigitPostalCode, validate5DigitPostalCode, validate6DigitPostalCode, validateTaiwanPostalCode } from './taiwan/postal-code.js';
27
- export { TwTelMessages, TwTelOptions, TwTelSchema, twTel, validateTaiwanTel } from './taiwan/tel.js';
27
+ export { TwTelMessages, TwTelOptions, TwTelSchema, ValidateTaiwanTelOptions, twTel, validateTaiwanInternationalTollFree, validateTaiwanTel } from './taiwan/tel.js';
28
28
  export { L as Locale, g as getLocale, s as setLocale } from './config-CABSSvAp.js';
29
29
  import 'zod';
30
30
  import 'dayjs';
package/dist/index.js CHANGED
@@ -49,8 +49,9 @@ import {
49
49
  } from "./chunk-D55YFP5R.js";
50
50
  import {
51
51
  twTel,
52
+ validateTaiwanInternationalTollFree,
52
53
  validateTaiwanTel
53
- } from "./chunk-ADKXVZHH.js";
54
+ } from "./chunk-IZEVVOXI.js";
54
55
  import {
55
56
  twFax,
56
57
  validateTaiwanFax
@@ -76,7 +77,7 @@ import {
76
77
  } from "./chunk-6IAPM7BP.js";
77
78
  import {
78
79
  url
79
- } from "./chunk-U2PB6XEO.js";
80
+ } from "./chunk-2XLAXQGM.js";
80
81
  import {
81
82
  creditCard,
82
83
  detectCardType,
@@ -92,20 +93,20 @@ import {
92
93
  } from "./chunk-LC4RNKBM.js";
93
94
  import {
94
95
  date
95
- } from "./chunk-RVGCMQ4J.js";
96
+ } from "./chunk-S5N6EFNB.js";
96
97
  import {
97
98
  DATETIME_PATTERNS,
98
99
  datetime,
99
100
  normalizeDateTimeValue,
100
101
  parseDateTimeValue,
101
102
  validateDateTimeFormat
102
- } from "./chunk-RHKBT3M2.js";
103
+ } from "./chunk-B6XAA3UV.js";
103
104
  import {
104
105
  email
105
106
  } from "./chunk-XAN4CAVH.js";
106
107
  import {
107
108
  file
108
- } from "./chunk-OGU7AIZF.js";
109
+ } from "./chunk-LUFTQDGA.js";
109
110
  import {
110
111
  ID_PATTERNS,
111
112
  detectIdType,
@@ -177,6 +178,7 @@ export {
177
178
  validateTaiwanBankAccount,
178
179
  validateTaiwanBusinessId,
179
180
  validateTaiwanFax,
181
+ validateTaiwanInternationalTollFree,
180
182
  validateTaiwanInvoice,
181
183
  validateTaiwanLicensePlate,
182
184
  validateTaiwanMobile,
@@ -1,9 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunk7EUHTSMFcjs = require('../chunk-7EUHTSMF.cjs');
4
+
5
+ var _chunkSFJZLW6Pcjs = require('../chunk-SFJZLW6P.cjs');
5
6
  require('../chunk-Q7TUNJD4.cjs');
6
7
 
7
8
 
8
9
 
9
- exports.twTel = _chunk7EUHTSMFcjs.twTel; exports.validateTaiwanTel = _chunk7EUHTSMFcjs.validateTaiwanTel;
10
+
11
+ exports.twTel = _chunkSFJZLW6Pcjs.twTel; exports.validateTaiwanInternationalTollFree = _chunkSFJZLW6Pcjs.validateTaiwanInternationalTollFree; exports.validateTaiwanTel = _chunkSFJZLW6Pcjs.validateTaiwanTel;
@@ -2,10 +2,10 @@ import { ZodString, ZodNullable } from 'zod';
2
2
  import { L as Locale } from '../config-CABSSvAp.cjs';
3
3
 
4
4
  /**
5
- * @fileoverview Taiwan Landline Telephone Number validator for Zod Kit
5
+ * @fileoverview Taiwan Telephone Number validator for Zod Kit
6
6
  *
7
- * Provides validation for Taiwan landline telephone numbers according to the
8
- * official 2024 telecom numbering plan with comprehensive area code support.
7
+ * Provides validation for Taiwan telephone numbers according to the official
8
+ * 2024 telecom numbering plan with area code and service code support.
9
9
  *
10
10
  * @author Ong Hoe Yuan
11
11
  * @version 0.0.5
@@ -25,19 +25,21 @@ type TwTelMessages = {
25
25
  notInWhitelist?: string;
26
26
  };
27
27
  /**
28
- * Configuration options for Taiwan landline telephone validation
28
+ * Configuration options for Taiwan telephone validation
29
29
  *
30
30
  * @template IsRequired - Whether the field is required (affects return type)
31
31
  *
32
32
  * @interface TwTelOptions
33
33
  * @property {IsRequired} [required=true] - Whether the field is required
34
34
  * @property {string[]} [whitelist] - Array of specific telephone numbers that are always allowed
35
+ * @property {boolean} [allowITFS=false] - Whether to allow 008 international toll-free numbers
35
36
  * @property {Function} [transform] - Custom transformation function for telephone number
36
37
  * @property {string | null} [defaultValue] - Default value when input is empty
37
38
  * @property {Record<Locale, TwTelMessages>} [i18n] - Custom error messages for different locales
38
39
  */
39
40
  type TwTelOptions<IsRequired extends boolean = true> = {
40
41
  whitelist?: string[];
42
+ allowITFS?: boolean;
41
43
  transform?: (value: string) => string;
42
44
  defaultValue?: IsRequired extends true ? string : string | null;
43
45
  i18n?: Partial<Record<Locale, Partial<TwTelMessages>>>;
@@ -50,16 +52,27 @@ type TwTelOptions<IsRequired extends boolean = true> = {
50
52
  * @description Returns ZodString if required, ZodNullable<ZodString> if optional
51
53
  */
52
54
  type TwTelSchema<IsRequired extends boolean> = IsRequired extends true ? ZodString : ZodNullable<ZodString>;
55
+ type ValidateTaiwanTelOptions = {
56
+ allowITFS?: boolean;
57
+ };
58
+ /**
59
+ * Validates Taiwan-dialed international toll-free number format.
60
+ *
61
+ * Supported formats:
62
+ * - 00800 + 8-digit Global Subscriber Number (UIFN)
63
+ * - 00801~00809 + 1-12 digit carrier-defined subscriber number (ITFS)
64
+ */
65
+ declare const validateTaiwanInternationalTollFree: (value: string) => boolean;
53
66
  /**
54
- * Validates Taiwan landline telephone number format (Official 2024 rules)
67
+ * Validates Taiwan telephone number format (Official 2024 rules)
55
68
  *
56
69
  * @param {string} value - The telephone number to validate
70
+ * @param {ValidateTaiwanTelOptions} [options] - Optional validation settings
57
71
  * @returns {boolean} True if the telephone number is valid
58
72
  *
59
73
  * @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.
74
+ * Validates Taiwan telephone numbers according to the official 2024 telecom
75
+ * numbering plan. Supports Taiwan area codes and selected service codes.
63
76
  *
64
77
  * Supported area codes and formats:
65
78
  * - 02: Taipei, New Taipei, Keelung - 8 digits
@@ -72,8 +85,10 @@ type TwTelSchema<IsRequired extends boolean> = IsRequired extends true ? ZodStri
72
85
  * - 07: Kaohsiung - 7-8 digits
73
86
  * - 08: Pingtung - 7 digits
74
87
  * - 070: VoIP / Internet Telephony (網路電話) - 8 digits (11 total)
75
- * - 0800: Toll-free - 6 digits
76
- * - 0809: Toll-free - 6 digits
88
+ * - 0800: Domestic recipient-paid/toll-free - 6 digits
89
+ * - 0809: Domestic recipient-paid/toll-free - 6 digits
90
+ * - 00800: Universal International Freephone Number (UIFN) when allowITFS is true
91
+ * - 00801~00809: International Toll-Free Service (ITFS) when allowITFS is true
77
92
  * - 082: Kinmen - 6 digits
78
93
  * - 0836: Matsu - 5-6 digits
79
94
  * - 089: Taitung - 6 digits
@@ -85,11 +100,12 @@ type TwTelSchema<IsRequired extends boolean> = IsRequired extends true ? ZodStri
85
100
  * validateTaiwanTel("037234567") // true (Miaoli area)
86
101
  * validateTaiwanTel("082234567") // true (Kinmen area)
87
102
  * validateTaiwanTel("02-2345-6789") // true (with separators)
103
+ * validateTaiwanTel("00801-852-747", { allowITFS: true }) // true (ITFS)
88
104
  * ```
89
105
  */
90
- declare const validateTaiwanTel: (value: string) => boolean;
106
+ declare const validateTaiwanTel: (value: string, options?: ValidateTaiwanTelOptions) => boolean;
91
107
  /**
92
- * Creates a Zod schema for Taiwan landline telephone number validation
108
+ * Creates a Zod schema for Taiwan telephone number validation
93
109
  *
94
110
  * @template IsRequired - Whether the field is required (affects return type)
95
111
  * @param {IsRequired} [required=false] - Whether the field is required
@@ -97,11 +113,13 @@ declare const validateTaiwanTel: (value: string) => boolean;
97
113
  * @returns {TwTelSchema<IsRequired>} Zod schema for telephone number validation
98
114
  *
99
115
  * @description
100
- * Creates a comprehensive Taiwan landline telephone number validator with support for
101
- * all Taiwan area codes according to the official 2024 telecom numbering plan.
116
+ * Creates a comprehensive Taiwan telephone number validator with support for
117
+ * Taiwan area codes and selected service codes according to the official 2024
118
+ * telecom numbering plan.
102
119
  *
103
120
  * Features:
104
121
  * - Complete Taiwan area code support (02, 03, 037, 04, 049, 05, 06, 07, 08, 082, 0826, 0836, 089)
122
+ * - Optional 008 international toll-free support (UIFN/ITFS)
105
123
  * - Automatic separator handling (hyphens and spaces)
106
124
  * - Area-specific number length and pattern validation
107
125
  * - Whitelist functionality for specific allowed numbers
@@ -145,6 +163,13 @@ declare const validateTaiwanTel: (value: string) => boolean;
145
163
  * transformSchema.parse("02-2345-6789") // ✓ Valid (separators removed)
146
164
  * transformSchema.parse("02 2345 6789") // ✓ Valid (spaces removed)
147
165
  *
166
+ * // With Taiwan-dialed international toll-free support
167
+ * const itfsSchema = twTel(false, {
168
+ * allowITFS: true
169
+ * })
170
+ * itfsSchema.parse("00800-2468-1668") // ✓ Valid (UIFN)
171
+ * itfsSchema.parse("00801-852-747") // ✓ Valid (ITFS)
172
+ *
148
173
  * // With custom error messages
149
174
  * const customSchema = twTel(false, {
150
175
  * i18n: {
@@ -160,4 +185,4 @@ declare const validateTaiwanTel: (value: string) => boolean;
160
185
  */
161
186
  declare function twTel<IsRequired extends boolean = false>(required?: IsRequired, options?: Omit<TwTelOptions<IsRequired>, 'required'>): TwTelSchema<IsRequired>;
162
187
 
163
- export { type TwTelMessages, type TwTelOptions, type TwTelSchema, twTel, validateTaiwanTel };
188
+ export { type TwTelMessages, type TwTelOptions, type TwTelSchema, type ValidateTaiwanTelOptions, twTel, validateTaiwanInternationalTollFree, validateTaiwanTel };
@@ -2,10 +2,10 @@ import { ZodString, ZodNullable } from 'zod';
2
2
  import { L as Locale } from '../config-CABSSvAp.js';
3
3
 
4
4
  /**
5
- * @fileoverview Taiwan Landline Telephone Number validator for Zod Kit
5
+ * @fileoverview Taiwan Telephone Number validator for Zod Kit
6
6
  *
7
- * Provides validation for Taiwan landline telephone numbers according to the
8
- * official 2024 telecom numbering plan with comprehensive area code support.
7
+ * Provides validation for Taiwan telephone numbers according to the official
8
+ * 2024 telecom numbering plan with area code and service code support.
9
9
  *
10
10
  * @author Ong Hoe Yuan
11
11
  * @version 0.0.5
@@ -25,19 +25,21 @@ type TwTelMessages = {
25
25
  notInWhitelist?: string;
26
26
  };
27
27
  /**
28
- * Configuration options for Taiwan landline telephone validation
28
+ * Configuration options for Taiwan telephone validation
29
29
  *
30
30
  * @template IsRequired - Whether the field is required (affects return type)
31
31
  *
32
32
  * @interface TwTelOptions
33
33
  * @property {IsRequired} [required=true] - Whether the field is required
34
34
  * @property {string[]} [whitelist] - Array of specific telephone numbers that are always allowed
35
+ * @property {boolean} [allowITFS=false] - Whether to allow 008 international toll-free numbers
35
36
  * @property {Function} [transform] - Custom transformation function for telephone number
36
37
  * @property {string | null} [defaultValue] - Default value when input is empty
37
38
  * @property {Record<Locale, TwTelMessages>} [i18n] - Custom error messages for different locales
38
39
  */
39
40
  type TwTelOptions<IsRequired extends boolean = true> = {
40
41
  whitelist?: string[];
42
+ allowITFS?: boolean;
41
43
  transform?: (value: string) => string;
42
44
  defaultValue?: IsRequired extends true ? string : string | null;
43
45
  i18n?: Partial<Record<Locale, Partial<TwTelMessages>>>;
@@ -50,16 +52,27 @@ type TwTelOptions<IsRequired extends boolean = true> = {
50
52
  * @description Returns ZodString if required, ZodNullable<ZodString> if optional
51
53
  */
52
54
  type TwTelSchema<IsRequired extends boolean> = IsRequired extends true ? ZodString : ZodNullable<ZodString>;
55
+ type ValidateTaiwanTelOptions = {
56
+ allowITFS?: boolean;
57
+ };
58
+ /**
59
+ * Validates Taiwan-dialed international toll-free number format.
60
+ *
61
+ * Supported formats:
62
+ * - 00800 + 8-digit Global Subscriber Number (UIFN)
63
+ * - 00801~00809 + 1-12 digit carrier-defined subscriber number (ITFS)
64
+ */
65
+ declare const validateTaiwanInternationalTollFree: (value: string) => boolean;
53
66
  /**
54
- * Validates Taiwan landline telephone number format (Official 2024 rules)
67
+ * Validates Taiwan telephone number format (Official 2024 rules)
55
68
  *
56
69
  * @param {string} value - The telephone number to validate
70
+ * @param {ValidateTaiwanTelOptions} [options] - Optional validation settings
57
71
  * @returns {boolean} True if the telephone number is valid
58
72
  *
59
73
  * @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.
74
+ * Validates Taiwan telephone numbers according to the official 2024 telecom
75
+ * numbering plan. Supports Taiwan area codes and selected service codes.
63
76
  *
64
77
  * Supported area codes and formats:
65
78
  * - 02: Taipei, New Taipei, Keelung - 8 digits
@@ -72,8 +85,10 @@ type TwTelSchema<IsRequired extends boolean> = IsRequired extends true ? ZodStri
72
85
  * - 07: Kaohsiung - 7-8 digits
73
86
  * - 08: Pingtung - 7 digits
74
87
  * - 070: VoIP / Internet Telephony (網路電話) - 8 digits (11 total)
75
- * - 0800: Toll-free - 6 digits
76
- * - 0809: Toll-free - 6 digits
88
+ * - 0800: Domestic recipient-paid/toll-free - 6 digits
89
+ * - 0809: Domestic recipient-paid/toll-free - 6 digits
90
+ * - 00800: Universal International Freephone Number (UIFN) when allowITFS is true
91
+ * - 00801~00809: International Toll-Free Service (ITFS) when allowITFS is true
77
92
  * - 082: Kinmen - 6 digits
78
93
  * - 0836: Matsu - 5-6 digits
79
94
  * - 089: Taitung - 6 digits
@@ -85,11 +100,12 @@ type TwTelSchema<IsRequired extends boolean> = IsRequired extends true ? ZodStri
85
100
  * validateTaiwanTel("037234567") // true (Miaoli area)
86
101
  * validateTaiwanTel("082234567") // true (Kinmen area)
87
102
  * validateTaiwanTel("02-2345-6789") // true (with separators)
103
+ * validateTaiwanTel("00801-852-747", { allowITFS: true }) // true (ITFS)
88
104
  * ```
89
105
  */
90
- declare const validateTaiwanTel: (value: string) => boolean;
106
+ declare const validateTaiwanTel: (value: string, options?: ValidateTaiwanTelOptions) => boolean;
91
107
  /**
92
- * Creates a Zod schema for Taiwan landline telephone number validation
108
+ * Creates a Zod schema for Taiwan telephone number validation
93
109
  *
94
110
  * @template IsRequired - Whether the field is required (affects return type)
95
111
  * @param {IsRequired} [required=false] - Whether the field is required
@@ -97,11 +113,13 @@ declare const validateTaiwanTel: (value: string) => boolean;
97
113
  * @returns {TwTelSchema<IsRequired>} Zod schema for telephone number validation
98
114
  *
99
115
  * @description
100
- * Creates a comprehensive Taiwan landline telephone number validator with support for
101
- * all Taiwan area codes according to the official 2024 telecom numbering plan.
116
+ * Creates a comprehensive Taiwan telephone number validator with support for
117
+ * Taiwan area codes and selected service codes according to the official 2024
118
+ * telecom numbering plan.
102
119
  *
103
120
  * Features:
104
121
  * - Complete Taiwan area code support (02, 03, 037, 04, 049, 05, 06, 07, 08, 082, 0826, 0836, 089)
122
+ * - Optional 008 international toll-free support (UIFN/ITFS)
105
123
  * - Automatic separator handling (hyphens and spaces)
106
124
  * - Area-specific number length and pattern validation
107
125
  * - Whitelist functionality for specific allowed numbers
@@ -145,6 +163,13 @@ declare const validateTaiwanTel: (value: string) => boolean;
145
163
  * transformSchema.parse("02-2345-6789") // ✓ Valid (separators removed)
146
164
  * transformSchema.parse("02 2345 6789") // ✓ Valid (spaces removed)
147
165
  *
166
+ * // With Taiwan-dialed international toll-free support
167
+ * const itfsSchema = twTel(false, {
168
+ * allowITFS: true
169
+ * })
170
+ * itfsSchema.parse("00800-2468-1668") // ✓ Valid (UIFN)
171
+ * itfsSchema.parse("00801-852-747") // ✓ Valid (ITFS)
172
+ *
148
173
  * // With custom error messages
149
174
  * const customSchema = twTel(false, {
150
175
  * i18n: {
@@ -160,4 +185,4 @@ declare const validateTaiwanTel: (value: string) => boolean;
160
185
  */
161
186
  declare function twTel<IsRequired extends boolean = false>(required?: IsRequired, options?: Omit<TwTelOptions<IsRequired>, 'required'>): TwTelSchema<IsRequired>;
162
187
 
163
- export { type TwTelMessages, type TwTelOptions, type TwTelSchema, twTel, validateTaiwanTel };
188
+ export { type TwTelMessages, type TwTelOptions, type TwTelSchema, type ValidateTaiwanTelOptions, twTel, validateTaiwanInternationalTollFree, validateTaiwanTel };
@@ -1,9 +1,11 @@
1
1
  import {
2
2
  twTel,
3
+ validateTaiwanInternationalTollFree,
3
4
  validateTaiwanTel
4
- } from "../chunk-ADKXVZHH.js";
5
+ } from "../chunk-IZEVVOXI.js";
5
6
  import "../chunk-POIDES2L.js";
6
7
  export {
7
8
  twTel,
9
+ validateTaiwanInternationalTollFree,
8
10
  validateTaiwanTel
9
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hy_ong/zod-kit",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "A comprehensive TypeScript library providing pre-built Zod validation schemas with full internationalization support for common data types and Taiwan-specific formats",
5
5
  "keywords": [
6
6
  "zod",
@@ -183,20 +183,20 @@
183
183
  "prepublishOnly": "npm test -- --run && npm run build"
184
184
  },
185
185
  "dependencies": {
186
- "dayjs": "^1.11.19"
186
+ "dayjs": "^1.11.20"
187
187
  },
188
188
  "peerDependencies": {
189
- "zod": "^4.3.6"
189
+ "zod": "^4.4.3"
190
190
  },
191
191
  "devDependencies": {
192
192
  "@eslint/js": "^10.0.1",
193
- "@types/node": "^25.4.0",
194
- "eslint": "^10.0.3",
195
- "jiti": "^2.6.1",
196
- "prettier": "^3.8.1",
193
+ "@types/node": "^25.9.1",
194
+ "eslint": "^10.4.0",
195
+ "jiti": "^2.7.0",
196
+ "prettier": "^3.8.3",
197
197
  "tsup": "^8.5.1",
198
- "typescript": "^5.9.3",
199
- "typescript-eslint": "^8.57.0",
200
- "vitest": "^4.0.18"
198
+ "typescript": "^6.0.3",
199
+ "typescript-eslint": "^8.59.4",
200
+ "vitest": "^4.1.7"
201
201
  }
202
202
  }
@@ -12,11 +12,11 @@ import { z, ZodNullable, ZodString } from "zod"
12
12
  import { t } from "../../i18n"
13
13
  import { getLocale, type Locale } from "../../config"
14
14
  import dayjs from "dayjs"
15
- import customParseFormat from "dayjs/plugin/customParseFormat"
16
- import isSameOrAfter from "dayjs/plugin/isSameOrAfter"
17
- import isSameOrBefore from "dayjs/plugin/isSameOrBefore"
18
- import isToday from "dayjs/plugin/isToday"
19
- import weekday from "dayjs/plugin/weekday"
15
+ import customParseFormat from "dayjs/plugin/customParseFormat.js"
16
+ import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js"
17
+ import isSameOrBefore from "dayjs/plugin/isSameOrBefore.js"
18
+ import isToday from "dayjs/plugin/isToday.js"
19
+ import weekday from "dayjs/plugin/weekday.js"
20
20
 
21
21
  // Initialize dayjs plugins for extended date functionality
22
22
  dayjs.extend(isSameOrAfter)
@@ -12,13 +12,13 @@ import { z, ZodNullable, ZodString } from "zod"
12
12
  import { t } from "../../i18n"
13
13
  import { getLocale, type Locale } from "../../config"
14
14
  import dayjs from "dayjs"
15
- import customParseFormat from "dayjs/plugin/customParseFormat"
16
- import isSameOrAfter from "dayjs/plugin/isSameOrAfter"
17
- import isSameOrBefore from "dayjs/plugin/isSameOrBefore"
18
- import isToday from "dayjs/plugin/isToday"
19
- import weekday from "dayjs/plugin/weekday"
20
- import timezone from "dayjs/plugin/timezone"
21
- import utc from "dayjs/plugin/utc"
15
+ import customParseFormat from "dayjs/plugin/customParseFormat.js"
16
+ import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js"
17
+ import isSameOrBefore from "dayjs/plugin/isSameOrBefore.js"
18
+ import isToday from "dayjs/plugin/isToday.js"
19
+ import weekday from "dayjs/plugin/weekday.js"
20
+ import timezone from "dayjs/plugin/timezone.js"
21
+ import utc from "dayjs/plugin/utc.js"
22
22
 
23
23
  // Initialize dayjs plugins for extended functionality
24
24
  dayjs.extend(isSameOrAfter)
@@ -103,6 +103,22 @@ export type FileOptions<IsRequired extends boolean = true> = {
103
103
  */
104
104
  export type FileSchema<IsRequired extends boolean> = IsRequired extends true ? ZodType<File, File | null> : ZodType<File | null, File | null>
105
105
 
106
+ function getFileConstructor(): typeof File | undefined {
107
+ return typeof globalThis.File === "function" ? globalThis.File : undefined
108
+ }
109
+
110
+ function isFileLike(value: unknown): value is File {
111
+ if (value === null || typeof value !== "object") return false
112
+
113
+ const candidate = value as Partial<File>
114
+ return typeof candidate.name === "string" && typeof candidate.size === "number" && typeof candidate.type === "string"
115
+ }
116
+
117
+ function isFileValue(value: unknown): value is File {
118
+ const FileConstructor = getFileConstructor()
119
+ return FileConstructor ? value instanceof FileConstructor : isFileLike(value)
120
+ }
121
+
106
122
  /**
107
123
  * Creates a Zod schema for file validation with comprehensive filtering options
108
124
  *
@@ -233,14 +249,14 @@ export function file<IsRequired extends boolean = false>(required?: IsRequired,
233
249
  const actualDefaultValue = defaultValue ?? null
234
250
 
235
251
  // Create properly typed base schema for File | null
236
- const fileOrNullSchema = z.union([z.instanceof(File), z.null()])
252
+ const fileOrNullSchema = z.union([z.custom<File>(isFileValue, { message: getMessage("invalid") }), z.null()])
237
253
 
238
254
  const baseSchema = z.preprocess((val): File | null => {
239
255
  if (val === "" || val === null || val === undefined) {
240
256
  return actualDefaultValue
241
257
  }
242
258
 
243
- if (!(val instanceof File)) {
259
+ if (!isFileValue(val)) {
244
260
  return val as File | null
245
261
  }
246
262
 
@@ -257,7 +273,7 @@ export function file<IsRequired extends boolean = false>(required?: IsRequired,
257
273
  .refine((val) => !isRequired || val !== null, {
258
274
  message: getMessage("required"),
259
275
  })
260
- .refine((val) => val === null || val instanceof File, {
276
+ .refine((val) => val === null || isFileValue(val), {
261
277
  message: getMessage("invalid"),
262
278
  })
263
279
  .refine((val) => val === null || minSize === undefined || val.size >= minSize, {