@hy_ong/zod-kit 0.0.4 → 0.0.6

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 (59) hide show
  1. package/.claude/settings.local.json +28 -0
  2. package/LICENSE +21 -0
  3. package/README.md +465 -97
  4. package/debug.js +21 -0
  5. package/debug.ts +16 -0
  6. package/dist/index.cjs +3127 -146
  7. package/dist/index.d.cts +3021 -25
  8. package/dist/index.d.ts +3021 -25
  9. package/dist/index.js +3081 -144
  10. package/eslint.config.mts +8 -0
  11. package/package.json +10 -9
  12. package/src/config.ts +1 -1
  13. package/src/i18n/locales/en.json +161 -25
  14. package/src/i18n/locales/zh-TW.json +165 -26
  15. package/src/index.ts +17 -7
  16. package/src/validators/common/boolean.ts +191 -0
  17. package/src/validators/common/date.ts +299 -0
  18. package/src/validators/common/datetime.ts +673 -0
  19. package/src/validators/common/email.ts +313 -0
  20. package/src/validators/common/file.ts +384 -0
  21. package/src/validators/common/id.ts +471 -0
  22. package/src/validators/common/number.ts +319 -0
  23. package/src/validators/common/password.ts +386 -0
  24. package/src/validators/common/text.ts +271 -0
  25. package/src/validators/common/time.ts +600 -0
  26. package/src/validators/common/url.ts +347 -0
  27. package/src/validators/taiwan/business-id.ts +262 -0
  28. package/src/validators/taiwan/fax.ts +327 -0
  29. package/src/validators/taiwan/mobile.ts +242 -0
  30. package/src/validators/taiwan/national-id.ts +425 -0
  31. package/src/validators/taiwan/postal-code.ts +1049 -0
  32. package/src/validators/taiwan/tel.ts +330 -0
  33. package/tests/common/boolean.test.ts +340 -92
  34. package/tests/common/date.test.ts +458 -0
  35. package/tests/common/datetime.test.ts +693 -0
  36. package/tests/common/email.test.ts +232 -60
  37. package/tests/common/file.test.ts +479 -0
  38. package/tests/common/id.test.ts +535 -0
  39. package/tests/common/number.test.ts +230 -60
  40. package/tests/common/password.test.ts +271 -44
  41. package/tests/common/text.test.ts +210 -13
  42. package/tests/common/time.test.ts +528 -0
  43. package/tests/common/url.test.ts +492 -67
  44. package/tests/taiwan/business-id.test.ts +240 -0
  45. package/tests/taiwan/fax.test.ts +463 -0
  46. package/tests/taiwan/mobile.test.ts +373 -0
  47. package/tests/taiwan/national-id.test.ts +435 -0
  48. package/tests/taiwan/postal-code.test.ts +705 -0
  49. package/tests/taiwan/tel.test.ts +467 -0
  50. package/eslint.config.mjs +0 -10
  51. package/src/common/boolean.ts +0 -36
  52. package/src/common/date.ts +0 -43
  53. package/src/common/email.ts +0 -44
  54. package/src/common/integer.ts +0 -46
  55. package/src/common/number.ts +0 -37
  56. package/src/common/password.ts +0 -33
  57. package/src/common/text.ts +0 -34
  58. package/src/common/url.ts +0 -37
  59. package/tests/common/integer.test.ts +0 -90
@@ -0,0 +1,8 @@
1
+ import eslintJs from "@eslint/js"
2
+ import eslintTs from "typescript-eslint"
3
+
4
+ export default eslintTs.config(eslintJs.configs.recommended, eslintTs.configs.recommended, {
5
+ rules: {
6
+ "@typescript-eslint/no-explicit-any": "off",
7
+ },
8
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hy_ong/zod-kit",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Zod Kit",
5
5
  "keywords": [
6
6
  "hy_ong",
@@ -19,7 +19,7 @@
19
19
  "publishConfig": {
20
20
  "access": "public"
21
21
  },
22
- "license": "ISC",
22
+ "license": "MIT",
23
23
  "author": "Ong Hoe Yuan",
24
24
  "type": "module",
25
25
  "main": "dist/index.cjs",
@@ -29,7 +29,7 @@
29
29
  ".": {
30
30
  "import": "./dist/index.js",
31
31
  "require": "./dist/index.cjs",
32
- "types": "./dist/index.d.ts"
32
+ "default": "./dist/index.js"
33
33
  }
34
34
  },
35
35
  "scripts": {
@@ -37,17 +37,18 @@
37
37
  "test": "vitest"
38
38
  },
39
39
  "dependencies": {
40
- "dayjs": "^1.11.13",
41
- "zod": "^4.0.15"
40
+ "dayjs": "^1.11.14",
41
+ "zod": "^4.1.4"
42
42
  },
43
43
  "devDependencies": {
44
- "@eslint/js": "^9.32.0",
45
- "@types/node": "^22.17.0",
46
- "eslint": "^9.32.0",
44
+ "@eslint/js": "^9.34.0",
45
+ "@types/node": "^20.19.11",
46
+ "eslint": "^9.34.0",
47
+ "jiti": "^2.5.1",
47
48
  "prettier": "^3.6.2",
48
49
  "tsup": "^8.5.0",
49
50
  "typescript": "^5.8.3",
50
- "typescript-eslint": "^8.39.0",
51
+ "typescript-eslint": "^8.41.0",
51
52
  "vitest": "^3.2.4"
52
53
  }
53
54
  }
package/src/config.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type Locale = "zh-TW" | "en"
2
2
 
3
- let currentLocale: Locale = "zh-TW"
3
+ let currentLocale: Locale = "en"
4
4
 
5
5
  export const setLocale = (locale: Locale) => {
6
6
  currentLocale = locale
@@ -2,25 +2,40 @@
2
2
  "common": {
3
3
  "boolean": {
4
4
  "required": "Required",
5
- "shouldBe": {
6
- "true": "Must be True",
7
- "false": "Must be False"
8
- }
5
+ "shouldBeTrue": "Must be True",
6
+ "shouldBeFalse": "Must be False",
7
+ "invalid": "Must be a boolean value"
9
8
  },
10
9
  "email": {
11
10
  "required": "Required",
12
- "min": "Must be at least ${min} characters",
13
- "max": "Must be at most ${max} characters",
11
+ "invalid": "Invalid email format",
12
+ "minLength": "Must be at least ${minLength} characters",
13
+ "maxLength": "Must be at most ${maxLength} characters",
14
14
  "includes": "Must include ${includes}",
15
- "invalid": "Invalid format",
16
- "domain": "Must be under the domain @${domain}"
15
+ "domain": "Must be from domain: ${domain}",
16
+ "domainBlacklist": "Domain ${domain} is not allowed",
17
+ "businessOnly": "Only business email addresses are allowed",
18
+ "noDisposable": "Disposable email addresses are not allowed"
17
19
  },
18
20
  "url": {
19
21
  "required": "Required",
22
+ "invalid": "Invalid URL format",
20
23
  "min": "Must be at least ${min} characters",
21
24
  "max": "Must be at most ${max} characters",
22
25
  "includes": "Must include ${includes}",
23
- "invalid": "Invalid format"
26
+ "excludes": "Must not contain ${excludes}",
27
+ "protocol": "Protocol must be one of: ${protocols}",
28
+ "domain": "Domain must be one of: ${domains}",
29
+ "domainBlacklist": "Domain ${domain} is not allowed",
30
+ "port": "Port must be one of: ${ports}",
31
+ "pathStartsWith": "Path must start with ${path}",
32
+ "pathEndsWith": "Path must end with ${path}",
33
+ "hasQuery": "URL must have query parameters",
34
+ "noQuery": "URL must not have query parameters",
35
+ "hasFragment": "URL must have a fragment",
36
+ "noFragment": "URL must not have a fragment",
37
+ "localhost": "Localhost URLs are not allowed",
38
+ "noLocalhost": "Localhost URLs are not allowed"
24
39
  },
25
40
  "password": {
26
41
  "required": "Required",
@@ -29,40 +44,161 @@
29
44
  "uppercase": "Must include at least one uppercase letter",
30
45
  "lowercase": "Must include at least one lowercase letter",
31
46
  "digits": "Must include at least one digit",
32
- "special": "Must include at least one special character"
47
+ "special": "Must include at least one special character",
48
+ "noRepeating": "Must not contain repeating characters",
49
+ "noSequential": "Must not contain sequential characters",
50
+ "noCommonWords": "Must not contain common words or patterns",
51
+ "minStrength": "Password strength must be at least ${minStrength}",
52
+ "excludes": "Must not contain ${excludes}",
53
+ "includes": "Must include ${includes}",
54
+ "invalid": "Invalid password format"
33
55
  },
34
56
  "number": {
35
57
  "required": "Required",
36
- "min": "Must be at least ${min}",
37
- "max": "Must be at most ${max}"
38
- },
39
- "integer": {
40
- "required": "Required",
58
+ "invalid": "Must be a valid number",
59
+ "integer": "Must be an integer",
60
+ "float": "Must be a decimal number",
41
61
  "min": "Must be at least ${min}",
42
62
  "max": "Must be at most ${max}",
43
- "integer": "Must be an integer"
63
+ "positive": "Must be positive",
64
+ "negative": "Must be negative",
65
+ "nonNegative": "Must be non-negative",
66
+ "nonPositive": "Must be non-positive",
67
+ "multipleOf": "Must be a multiple of ${multipleOf}",
68
+ "finite": "Must be a finite number",
69
+ "precision": "Must have at most ${precision} decimal places"
44
70
  },
45
- "float": {
71
+ "id": {
46
72
  "required": "Required",
47
- "min": "Must be at least ${min}",
48
- "max": "Must be at most ${max}",
49
- "float": "Must be an float"
73
+ "invalid": "Invalid ID format",
74
+ "minLength": "Must be at least ${minLength} characters",
75
+ "maxLength": "Must be at most ${maxLength} characters",
76
+ "numeric": "Must be a numeric ID",
77
+ "uuid": "Must be a valid UUID",
78
+ "objectId": "Must be a valid MongoDB ObjectId",
79
+ "nanoid": "Must be a valid Nano ID",
80
+ "snowflake": "Must be a valid Snowflake ID",
81
+ "cuid": "Must be a valid CUID",
82
+ "ulid": "Must be a valid ULID",
83
+ "shortid": "Must be a valid Short ID",
84
+ "customFormat": "Invalid ID format",
85
+ "includes": "Must include ${includes}",
86
+ "excludes": "Must not contain ${excludes}",
87
+ "startsWith": "Must start with ${startsWith}",
88
+ "endsWith": "Must end with ${endsWith}"
50
89
  },
51
90
  "text": {
52
91
  "required": "Required",
53
- "min": "Must be at least ${min} characters",
54
- "max": "Must be at most ${max} characters",
92
+ "notEmpty": "Cannot be empty or whitespace only",
93
+ "minLength": "Must be at least ${minLength} characters",
94
+ "maxLength": "Must be at most ${maxLength} characters",
55
95
  "startsWith": "Must start with ${startsWith}",
56
96
  "endsWith": "Must end with ${endsWith}",
57
97
  "includes": "Must include ${includes}",
98
+ "excludes": "Must not contain ${excludes}",
58
99
  "invalid": "Invalid format"
59
100
  },
60
101
  "date": {
61
102
  "required": "Required",
62
- "min": "Must be at least ${min} characters",
63
- "max": "Must be at most ${max} characters",
103
+ "invalid": "Invalid date",
104
+ "format": "Must be in ${format} format",
105
+ "min": "Date must be on or after ${min}",
106
+ "max": "Date must be on or before ${max}",
107
+ "includes": "Must include ${includes}",
108
+ "excludes": "Must not contain ${excludes}",
109
+ "past": "Date must be in the past",
110
+ "future": "Date must be in the future",
111
+ "today": "Date must be today",
112
+ "notToday": "Date must not be today",
113
+ "weekday": "Date must be a weekday (Monday-Friday)",
114
+ "weekend": "Date must be a weekend (Saturday-Sunday)"
115
+ },
116
+ "time": {
117
+ "required": "Required",
118
+ "invalid": "Invalid time format",
119
+ "format": "Must be in ${format} format",
120
+ "min": "Time must be after ${min}",
121
+ "max": "Time must be before ${max}",
122
+ "hour": "Hour must be between ${minHour} and ${maxHour}",
123
+ "minute": "Minutes must be in ${minuteStep}-minute intervals",
124
+ "second": "Seconds must be in ${secondStep}-second intervals",
64
125
  "includes": "Must include ${includes}",
65
- "format": "Must be in ${format} format"
126
+ "excludes": "Must not contain ${excludes}",
127
+ "customRegex": "Invalid time format",
128
+ "notInWhitelist": "Time is not in the allowed list"
129
+ },
130
+ "datetime": {
131
+ "required": "Required",
132
+ "invalid": "Invalid datetime format",
133
+ "format": "Must be in ${format} format",
134
+ "min": "DateTime must be after ${min}",
135
+ "max": "DateTime must be before ${max}",
136
+ "hour": "Hour must be between ${minHour} and ${maxHour}",
137
+ "minute": "Minutes must be in ${minuteStep}-minute intervals",
138
+ "includes": "Must include ${includes}",
139
+ "excludes": "Must not contain ${excludes}",
140
+ "past": "DateTime must be in the past",
141
+ "future": "DateTime must be in the future",
142
+ "today": "DateTime must be today",
143
+ "notToday": "DateTime must not be today",
144
+ "weekday": "DateTime must be a weekday (Monday-Friday)",
145
+ "weekend": "DateTime must be a weekend (Saturday-Sunday)",
146
+ "customRegex": "Invalid datetime format",
147
+ "notInWhitelist": "DateTime is not in the allowed list"
148
+ },
149
+ "file": {
150
+ "required": "Required",
151
+ "invalid": "Invalid file format",
152
+ "size": "File size must not exceed ${size}",
153
+ "minSize": "File size must be at least ${minSize}",
154
+ "maxSize": "File size must not exceed ${maxSize}",
155
+ "type": "File type must be one of: ${type}",
156
+ "extension": "File extension must be one of: ${extension}",
157
+ "extensionBlacklist": "File extension ${extension} is not allowed",
158
+ "name": "File name must match pattern ${pattern}",
159
+ "nameBlacklist": "File name must not match pattern ${pattern}",
160
+ "imageOnly": "Only image files are allowed",
161
+ "documentOnly": "Only document files are allowed",
162
+ "videoOnly": "Only video files are allowed",
163
+ "audioOnly": "Only audio files are allowed",
164
+ "archiveOnly": "Only archive files are allowed"
165
+ }
166
+ },
167
+ "taiwan": {
168
+ "businessId": {
169
+ "required": "Required",
170
+ "invalid": "Invalid Taiwan Business ID"
171
+ },
172
+ "nationalId": {
173
+ "required": "Required",
174
+ "invalid": "Invalid Taiwan National ID"
175
+ },
176
+ "mobile": {
177
+ "required": "Required",
178
+ "invalid": "Invalid Taiwan mobile phone format",
179
+ "notInWhitelist": "Not in allowed mobile phone list"
180
+ },
181
+ "tel": {
182
+ "required": "Required",
183
+ "invalid": "Invalid Taiwan telephone format",
184
+ "notInWhitelist": "Not in allowed telephone list"
185
+ },
186
+ "fax": {
187
+ "required": "Required",
188
+ "invalid": "Invalid Taiwan fax format",
189
+ "notInWhitelist": "Not in allowed fax list"
190
+ },
191
+ "postalCode": {
192
+ "required": "Required",
193
+ "invalid": "Invalid Taiwan postal code",
194
+ "invalidFormat": "Invalid postal code format",
195
+ "invalidRange": "Postal code is outside valid range",
196
+ "legacy5DigitWarning": "5-digit postal codes are legacy format, consider using 6-digit format",
197
+ "format3Only": "Only 3-digit postal codes are allowed",
198
+ "format5Only": "Only 5-digit postal codes are allowed",
199
+ "format6Only": "Only 6-digit postal codes are allowed",
200
+ "invalidSuffix": "Invalid postal code suffix - must be 01-99 for 5-digit or 001-999 for 6-digit codes",
201
+ "deprecated5Digit": "5-digit postal codes are deprecated and no longer supported"
66
202
  }
67
203
  }
68
204
  }
@@ -2,25 +2,40 @@
2
2
  "common": {
3
3
  "boolean": {
4
4
  "required": "必填",
5
- "shouldBe": {
6
- "true": "必須為是",
7
- "false": "必須為否"
8
- }
5
+ "shouldBeTrue": "必須為是",
6
+ "shouldBeFalse": "必須為否",
7
+ "invalid": "必須為布林值"
9
8
  },
10
9
  "email": {
11
10
  "required": "必填",
12
- "min": "長度至少 ${min} 字元",
13
- "max": "長度最多 ${max} 字元",
11
+ "invalid": "電子郵件格式錯誤",
12
+ "minLength": "長度至少 ${minLength} 字元",
13
+ "maxLength": "長度最多 ${maxLength} 字元",
14
14
  "includes": "必須包含「${includes}」",
15
- "invalid": "格式錯誤",
16
- "domain": "必須為 @${domain} 網域"
15
+ "domain": "必須為 ${domain} 網域",
16
+ "domainBlacklist": "不允許使用 ${domain} 網域",
17
+ "businessOnly": "僅允許企業郵箱地址",
18
+ "noDisposable": "不允許使用臨時郵箱地址"
17
19
  },
18
20
  "url": {
19
21
  "required": "必填",
22
+ "invalid": "無效的 URL 格式",
20
23
  "min": "長度至少 ${min} 字元",
21
24
  "max": "長度最多 ${max} 字元",
22
25
  "includes": "必須包含「${includes}」",
23
- "invalid": "格式錯誤"
26
+ "excludes": "不得包含「${excludes}」",
27
+ "protocol": "協議必須為:${protocols}",
28
+ "domain": "網域必須為:${domains}",
29
+ "domainBlacklist": "不允許使用網域 ${domain}",
30
+ "port": "連接埠必須為:${ports}",
31
+ "pathStartsWith": "路徑必須以「${path}」開頭",
32
+ "pathEndsWith": "路徑必須以「${path}」結尾",
33
+ "hasQuery": "URL 必須包含查詢參數",
34
+ "noQuery": "URL 不得包含查詢參數",
35
+ "hasFragment": "URL 必須包含錨點",
36
+ "noFragment": "URL 不得包含錨點",
37
+ "localhost": "不允許使用本機 URL",
38
+ "noLocalhost": "不允許使用本機 URL"
24
39
  },
25
40
  "password": {
26
41
  "required": "必填",
@@ -29,37 +44,161 @@
29
44
  "uppercase": "必須包含至少一個大寫字母",
30
45
  "lowercase": "必須包含至少一個小寫字母",
31
46
  "digits": "必須包含至少一個數字",
32
- "special": "必須包含至少一個特殊符號"
47
+ "special": "必須包含至少一個特殊符號",
48
+ "noRepeating": "不可包含重複字元",
49
+ "noSequential": "不可包含連續字元",
50
+ "noCommonWords": "不可包含常見密碼或模式",
51
+ "minStrength": "密碼強度必須至少為 ${minStrength}",
52
+ "excludes": "不得包含「${excludes}」",
53
+ "includes": "必須包含「${includes}」",
54
+ "invalid": "密碼格式錯誤"
33
55
  },
34
56
  "number": {
35
57
  "required": "必填",
36
- "min": "最小值 ${min}",
37
- "max": "最大值 ${max}"
38
- },
39
- "id": {
40
- "required": "請選擇",
41
- "invalid": "無效"
42
- },
43
- "integer": {
44
- "required": "必填",
58
+ "invalid": "必須為有效數字",
59
+ "integer": "必須為整數",
60
+ "float": "必須為小數",
45
61
  "min": "最小值 ${min}",
46
62
  "max": "最大值 ${max}",
47
- "integer": "必須為整數"
63
+ "positive": "必須為正數",
64
+ "negative": "必須為負數",
65
+ "nonNegative": "不可為負數",
66
+ "nonPositive": "不可為正數",
67
+ "multipleOf": "必須為 ${multipleOf} 的倍數",
68
+ "finite": "必須為有限數字",
69
+ "precision": "小數位數不可超過 ${precision} 位"
48
70
  },
49
- "float": {
71
+ "id": {
50
72
  "required": "必填",
51
- "float": "必須為浮點數",
52
- "min": "最小值 ${min}",
53
- "max": "最大值 ${max}"
73
+ "invalid": "無效的 ID 格式",
74
+ "minLength": "長度至少 ${minLength} 字元",
75
+ "maxLength": "長度最多 ${maxLength} 字元",
76
+ "numeric": "必須為數字 ID",
77
+ "uuid": "必須為有效的 UUID",
78
+ "objectId": "必須為有效的 MongoDB ObjectId",
79
+ "nanoid": "必須為有效的 Nano ID",
80
+ "snowflake": "必須為有效的 Snowflake ID",
81
+ "cuid": "必須為有效的 CUID",
82
+ "ulid": "必須為有效的 ULID",
83
+ "shortid": "必須為有效的 Short ID",
84
+ "customFormat": "無效的 ID 格式",
85
+ "includes": "必須包含「${includes}」",
86
+ "excludes": "不得包含「${excludes}」",
87
+ "startsWith": "必須以「${startsWith}」開頭",
88
+ "endsWith": "必須以「${endsWith}」結尾"
54
89
  },
55
90
  "text": {
56
91
  "required": "必填",
57
- "min": "長度至少 ${min} 字元",
58
- "max": "長度最多 ${max} 字元",
92
+ "notEmpty": "不可為空白或僅含空格",
93
+ "minLength": "長度至少 ${minLength} 字元",
94
+ "maxLength": "長度最多 ${maxLength} 字元",
59
95
  "startsWith": "必須以「${startsWith}」開頭",
60
96
  "endsWith": "必須以「${endsWith}」結尾",
61
97
  "includes": "必須包含「${includes}」",
98
+ "excludes": "不得包含「${excludes}」",
62
99
  "invalid": "格式錯誤"
100
+ },
101
+ "date": {
102
+ "required": "必填",
103
+ "invalid": "無效日期",
104
+ "format": "必須為 ${format} 格式",
105
+ "min": "日期不得早於 ${min}",
106
+ "max": "日期不得晚於 ${max}",
107
+ "includes": "必須包含「${includes}」",
108
+ "excludes": "不得包含「${excludes}」",
109
+ "past": "必須為過去的日期",
110
+ "future": "必須為未來的日期",
111
+ "today": "必須為今天",
112
+ "notToday": "不得為今天",
113
+ "weekday": "必須為工作日(週一至週五)",
114
+ "weekend": "必須為週末(週六至週日)"
115
+ },
116
+ "time": {
117
+ "required": "必填",
118
+ "invalid": "無效的時間格式",
119
+ "format": "必須為 ${format} 格式",
120
+ "min": "時間不得早於 ${min}",
121
+ "max": "時間不得晚於 ${max}",
122
+ "hour": "小時必須介於 ${minHour} 與 ${maxHour} 之間",
123
+ "minute": "分鐘必須為 ${minuteStep} 分鐘間隔",
124
+ "second": "秒數必須為 ${secondStep} 秒間隔",
125
+ "includes": "必須包含「${includes}」",
126
+ "excludes": "不得包含「${excludes}」",
127
+ "customRegex": "無效的時間格式",
128
+ "notInWhitelist": "時間不在允許清單中"
129
+ },
130
+ "datetime": {
131
+ "required": "必填",
132
+ "invalid": "無效的日期時間格式",
133
+ "format": "必須為 ${format} 格式",
134
+ "min": "日期時間不得早於 ${min}",
135
+ "max": "日期時間不得晚於 ${max}",
136
+ "hour": "小時必須介於 ${minHour} 與 ${maxHour} 之間",
137
+ "minute": "分鐘必須為 ${minuteStep} 分鐘間隔",
138
+ "includes": "必須包含「${includes}」",
139
+ "excludes": "不得包含「${excludes}」",
140
+ "past": "必須為過去的日期時間",
141
+ "future": "必須為未來的日期時間",
142
+ "today": "必須為今天",
143
+ "notToday": "不得為今天",
144
+ "weekday": "必須為工作日(週一至週五)",
145
+ "weekend": "必須為週末(週六至週日)",
146
+ "customRegex": "無效的日期時間格式",
147
+ "notInWhitelist": "日期時間不在允許清單中"
148
+ },
149
+ "file": {
150
+ "required": "必填",
151
+ "invalid": "無效的檔案格式",
152
+ "size": "檔案大小不得超過 ${size}",
153
+ "minSize": "檔案大小至少 ${minSize}",
154
+ "maxSize": "檔案大小不得超過 ${maxSize}",
155
+ "type": "檔案類型必須為:${type}",
156
+ "extension": "副檔名必須為:${extension}",
157
+ "extensionBlacklist": "不允許使用副檔名 ${extension}",
158
+ "name": "檔案名稱必須符合格式 ${pattern}",
159
+ "nameBlacklist": "檔案名稱不得符合格式 ${pattern}",
160
+ "imageOnly": "僅允許圖片檔案",
161
+ "documentOnly": "僅允許文件檔案",
162
+ "videoOnly": "僅允許影片檔案",
163
+ "audioOnly": "僅允許音訊檔案",
164
+ "archiveOnly": "僅允許壓縮檔案"
165
+ }
166
+ },
167
+ "taiwan": {
168
+ "businessId": {
169
+ "required": "必填",
170
+ "invalid": "無效的統一編號"
171
+ },
172
+ "nationalId": {
173
+ "required": "必填",
174
+ "invalid": "無效的身分證字號"
175
+ },
176
+ "mobile": {
177
+ "required": "必填",
178
+ "invalid": "無效的手機號碼格式",
179
+ "notInWhitelist": "不在允許的手機號碼清單中"
180
+ },
181
+ "tel": {
182
+ "required": "必填",
183
+ "invalid": "無效的市話號碼格式",
184
+ "notInWhitelist": "不在允許的市話號碼清單中"
185
+ },
186
+ "fax": {
187
+ "required": "必填",
188
+ "invalid": "無效的傳真號碼格式",
189
+ "notInWhitelist": "不在允許的傳真號碼清單中"
190
+ },
191
+ "postalCode": {
192
+ "required": "必填",
193
+ "invalid": "無效的郵遞區號",
194
+ "invalidFormat": "郵遞區號格式錯誤",
195
+ "invalidRange": "郵遞區號超出有效範圍",
196
+ "legacy5DigitWarning": "5 碼郵遞區號為舊式格式,建議使用 6 碼格式",
197
+ "format3Only": "僅允許 3 碼郵遞區號",
198
+ "format5Only": "僅允許 5 碼郵遞區號",
199
+ "format6Only": "僅允許 6 碼郵遞區號",
200
+ "invalidSuffix": "無效的郵遞區號後碼 - 5 碼格式須為 01-99,6 碼格式須為 001-999",
201
+ "deprecated5Digit": "5 碼郵遞區號已棄用且不再支援"
63
202
  }
64
203
  }
65
204
  }
package/src/index.ts CHANGED
@@ -1,8 +1,18 @@
1
- export * from "./common/boolean"
2
- export * from "./common/email"
3
- export * from "./common/url"
4
- export * from "./common/text"
5
- export * from "./common/number"
6
- export * from "./common/password"
7
- export * from "./common/integer"
1
+ export * from "./validators/common/boolean"
2
+ export * from "./validators/common/date"
3
+ export * from "./validators/common/datetime"
4
+ export * from "./validators/common/email"
5
+ export * from "./validators/common/file"
6
+ export * from "./validators/common/id"
7
+ export * from "./validators/common/number"
8
+ export * from "./validators/common/password"
9
+ export * from "./validators/common/text"
10
+ export * from "./validators/common/time"
11
+ export * from "./validators/common/url"
12
+ export * from "./validators/taiwan/business-id"
13
+ export * from "./validators/taiwan/national-id"
14
+ export * from "./validators/taiwan/mobile"
15
+ export * from "./validators/taiwan/postal-code"
16
+ export * from "./validators/taiwan/tel"
17
+ export * from "./validators/taiwan/fax"
8
18
  export * from "./config"