valgen 5.13.3 → 5.14.0
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/CHANGELOG.md +154 -180
- package/cjs/rules/logical-rules/is-empty.js +35 -27
- package/esm/rules/logical-rules/is-empty.js +35 -27
- package/package.json +5 -2
- package/types/core/index.d.ts +1 -1
- package/types/index.d.cts +3 -3
- package/types/index.d.ts +3 -3
- package/types/rules/logical-rules/is-empty.d.ts +2 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,292 +1,266 @@
|
|
|
1
|
-
|
|
2
|
-
[2025-03-17]
|
|
1
|
+
## Changelog
|
|
3
2
|
|
|
4
|
-
###
|
|
3
|
+
### [v5.14.0](https://github.com/panates/valgen/compare/v5.13.4...v5.14.0) -
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
#### 🛠 Refactoring and Updates
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
[2025-03-15]
|
|
7
|
+
- refactor: Moved from jest to mocha @Eray Hanoğlu
|
|
10
8
|
|
|
11
|
-
###
|
|
9
|
+
### [v5.13.4](https://github.com/panates/valgen/compare/v5.13.3...v5.13.4) - 26 March 2025
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
#### 🪲 Fixes
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
[2025-03-14]
|
|
13
|
+
- fix: isNotEmpty do not work for number and boolean types @Eray Hanoğlu
|
|
17
14
|
|
|
18
|
-
###
|
|
15
|
+
### [v5.13.3](https://github.com/panates/valgen/compare/v5.13.2...v5.13.3) - 17 March 2025
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
* fix: Fixed validation of Date, Buffer and ArrayBuffer objects of isEmpty and isNotEmpty rules ([`37681bf`](https://github.com/panates/valgen/commit/37681bf88f5c0adf4f102856791b0b3a547aea74))
|
|
17
|
+
#### 🪲 Fixes
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
- fix: isEmpty and isNotEmpty rules adds error issue twice @Eray Hanoğlu
|
|
24
20
|
|
|
25
|
-
|
|
21
|
+
### [v5.13.2](https://github.com/panates/valgen/compare/v5.13.1...v5.13.2) - 15 March 2025
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
[2025-02-03]
|
|
23
|
+
#### 🪲 Fixes
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
- fix: Fixed ignoring pipe validators if context.errors has items. @Eray Hanoğlu
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
* refactor: Changed error messages to "positive sentences" ([`3b746df`](https://github.com/panates/valgen/commit/3b746df70ab0e25e32e3f5b957f1c24f3f0fcc70))
|
|
34
|
-
* chore: Updated github workflow ([`661738f`](https://github.com/panates/valgen/commit/661738f1fd90eed72ec2718e67159a8ab614e65e))
|
|
35
|
-
* dev: Fixed ts config ([`e3251ce`](https://github.com/panates/valgen/commit/e3251ce7776de3bd4afeb0c2d0ed5d19f6aabd4f))
|
|
36
|
-
* dev: Added missing script ([`dd019d9`](https://github.com/panates/valgen/commit/dd019d923f8305462e27cad1745564071c9c34bb))
|
|
27
|
+
### [v5.13.1](https://github.com/panates/valgen/compare/v5.13.0...v5.13.1) - 14 March 2025
|
|
37
28
|
|
|
38
|
-
|
|
39
|
-
[2024-11-04]
|
|
29
|
+
#### 🪲 Fixes
|
|
40
30
|
|
|
41
|
-
|
|
31
|
+
- fix: Fixed validation of Date, Buffer and ArrayBuffer objects of isEmpty and isNotEmpty rules @Eray Hanoğlu
|
|
32
|
+
- fix: Fixed validation of Date, Buffer and ArrayBuffer objects of isEmpty and isNotEmpty rules @Eray Hanoğlu
|
|
42
33
|
|
|
43
|
-
|
|
34
|
+
### [v5.13.0](https://github.com/panates/valgen/compare/v5.12.0...v5.13.0) - 3 February 2025
|
|
44
35
|
|
|
45
|
-
|
|
46
|
-
[2024-11-04]
|
|
36
|
+
#### 🛠 Refactoring and Updates
|
|
47
37
|
|
|
48
|
-
|
|
38
|
+
- refactor: Updated dependencies @Eray Hanoğlu
|
|
39
|
+
- refactor: Changed error messages to "positive sentences" @Eray Hanoğlu
|
|
49
40
|
|
|
50
|
-
|
|
41
|
+
#### 💬 General Changes
|
|
51
42
|
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
- dev: Fixed ts config @Eray Hanoğlu
|
|
44
|
+
- dev: Added missing script @Eray Hanoğlu
|
|
54
45
|
|
|
55
|
-
###
|
|
46
|
+
### [v5.12.0](https://github.com/panates/valgen/compare/v5.11.0...v5.12.0) - 4 November 2024
|
|
56
47
|
|
|
57
|
-
|
|
58
|
-
* fixed: Circular imports ([`f2a83b9`](https://github.com/panates/valgen/commit/f2a83b9f466f1bc5acaabef3ac78f6c567ed7b54))
|
|
48
|
+
#### 🛠 Refactoring and Updates
|
|
59
49
|
|
|
60
|
-
|
|
61
|
-
[2024-08-20]
|
|
50
|
+
- refactor: Move from 'validator' library to "@browsery/validator" for ESM compatibility @Eray Hanoğlu
|
|
62
51
|
|
|
63
|
-
###
|
|
52
|
+
### [v5.11.0](https://github.com/panates/valgen/compare/v5.10.0...v5.11.0) - 4 November 2024
|
|
64
53
|
|
|
65
|
-
|
|
54
|
+
#### 💬 General Changes
|
|
66
55
|
|
|
67
|
-
|
|
68
|
-
[2024-08-12]
|
|
56
|
+
- nit: Updated dependencies @Eray Hanoğlu
|
|
69
57
|
|
|
70
|
-
###
|
|
58
|
+
### [v5.10.0](https://github.com/panates/valgen/compare/v5.9.0...v5.10.0) - 14 September 2024
|
|
71
59
|
|
|
72
|
-
|
|
60
|
+
#### 💬 General Changes
|
|
73
61
|
|
|
74
|
-
|
|
75
|
-
[2024-08-12]
|
|
62
|
+
- fixed: Circular imports @Eray Hanoğlu
|
|
76
63
|
|
|
77
|
-
###
|
|
64
|
+
### [v5.9.0](https://github.com/panates/valgen/compare/v5.8.2...v5.9.0) - 20 August 2024
|
|
78
65
|
|
|
79
|
-
|
|
66
|
+
#### 💬 General Changes
|
|
80
67
|
|
|
81
|
-
|
|
82
|
-
[2024-08-12]
|
|
68
|
+
- Fixed compatibility for "Node16" and "NodeNext" moduleResolution options @Eray Hanoğlu
|
|
83
69
|
|
|
84
|
-
###
|
|
70
|
+
### [v5.8.2](https://github.com/panates/valgen/compare/v5.8.1...v5.8.2) - 12 August 2024
|
|
85
71
|
|
|
86
|
-
|
|
72
|
+
#### 💬 General Changes
|
|
87
73
|
|
|
88
|
-
|
|
89
|
-
[2024-08-09]
|
|
74
|
+
- Applied publint to check package.json @Eray Hanoğlu
|
|
90
75
|
|
|
91
|
-
###
|
|
76
|
+
### [v5.8.1](https://github.com/panates/valgen/compare/v5.8.0...v5.8.1) - 12 August 2024
|
|
92
77
|
|
|
93
|
-
|
|
78
|
+
#### 💬 General Changes
|
|
94
79
|
|
|
95
|
-
|
|
96
|
-
[2024-07-14]
|
|
80
|
+
- Applied publint to check package.json @Eray Hanoğlu
|
|
97
81
|
|
|
98
|
-
###
|
|
82
|
+
### [v5.8.0](https://github.com/panates/valgen/compare/v5.7.0...v5.8.0) - 12 August 2024
|
|
99
83
|
|
|
100
|
-
|
|
101
|
-
* Added isNotNull and isNotNullish rules ([`ff881d6`](https://github.com/panates/valgen/commit/ff881d6be81068c70e020109485b91854c355598))
|
|
84
|
+
#### 💬 General Changes
|
|
102
85
|
|
|
103
|
-
|
|
104
|
-
[2024-07-14]
|
|
86
|
+
- Rollback to ES2020 @Eray Hanoğlu
|
|
105
87
|
|
|
106
|
-
###
|
|
88
|
+
### [v5.7.0](https://github.com/panates/valgen/compare/v5.6.0...v5.7.0) - 9 August 2024
|
|
107
89
|
|
|
108
|
-
|
|
109
|
-
* Changed error message ([`3edf948`](https://github.com/panates/valgen/commit/3edf948a674d11a4ff5efcb97ca255b0723a11ca))
|
|
110
|
-
* Removed coercing of isNull and isNullish rules ([`4337d0a`](https://github.com/panates/valgen/commit/4337d0a4bd148718f33f744257b13afdd5c3ac50))
|
|
111
|
-
* Now pipe can return original input value when returnIndex = -1 ([`baf698c`](https://github.com/panates/valgen/commit/baf698c289254743d70ef815188f2300d7230f00))
|
|
90
|
+
#### 💬 General Changes
|
|
112
91
|
|
|
113
|
-
|
|
114
|
-
[2024-05-18]
|
|
92
|
+
- Made ready for Node16 moduleResolution @Eray Hanoğlu
|
|
115
93
|
|
|
116
|
-
###
|
|
94
|
+
### [v5.6.0](https://github.com/panates/valgen/compare/v5.5.0...v5.6.0) - 14 July 2024
|
|
117
95
|
|
|
118
|
-
|
|
96
|
+
#### 💬 General Changes
|
|
119
97
|
|
|
120
|
-
|
|
121
|
-
|
|
98
|
+
- Added isNotNull and isNotNullish rules @Eray Hanoğlu
|
|
99
|
+
- Added isNotNull and isNotNullish rules @Eray Hanoğlu
|
|
122
100
|
|
|
123
|
-
###
|
|
101
|
+
### [v5.5.0](https://github.com/panates/valgen/compare/v5.4.1...v5.5.0) - 14 July 2024
|
|
124
102
|
|
|
125
|
-
|
|
126
|
-
* Updated circleci config ([`101361c`](https://github.com/panates/valgen/commit/101361c20f1b78a75392b9e796bc9075b492cb3e))
|
|
103
|
+
#### 💬 General Changes
|
|
127
104
|
|
|
128
|
-
|
|
129
|
-
|
|
105
|
+
- Moved eslint config to @panates/eslint-config @Eray Hanoğlu
|
|
106
|
+
- Changed error message @Eray Hanoğlu
|
|
107
|
+
- Removed coercing of isNull and isNullish rules @Eray Hanoğlu
|
|
108
|
+
- Now pipe can return original input value when returnIndex = -1 @Eray Hanoğlu
|
|
130
109
|
|
|
131
|
-
###
|
|
110
|
+
### [v5.4.1](https://github.com/panates/valgen/compare/v5.4.0...v5.4.1) - 18 May 2024
|
|
132
111
|
|
|
133
|
-
|
|
134
|
-
* Fixed coveralls token ([`ede2734`](https://github.com/panates/valgen/commit/ede27343a163ef6649866fedb141598518d6e1c3))
|
|
112
|
+
#### 💬 General Changes
|
|
135
113
|
|
|
136
|
-
|
|
137
|
-
[2024-05-18]
|
|
114
|
+
- Exposed toBigint @Eray Hanoğlu
|
|
138
115
|
|
|
139
|
-
###
|
|
116
|
+
### [v5.4.0](https://github.com/panates/valgen/compare/v5.3.2...v5.4.0) - 18 May 2024
|
|
140
117
|
|
|
141
|
-
|
|
142
|
-
* Updated code documentation ([`81e7ccf`](https://github.com/panates/valgen/commit/81e7ccf145075a0649cb7281062f422cd989dfa3))
|
|
143
|
-
* Fixed rule name ([`73d90d1`](https://github.com/panates/valgen/commit/73d90d14314d6d98d089c60134f05d651a2e4b0f))
|
|
118
|
+
#### 💬 General Changes
|
|
144
119
|
|
|
145
|
-
|
|
146
|
-
|
|
120
|
+
- Added returnIndex to pipe() @Eray Hanoğlu
|
|
121
|
+
- Updated circleci config @Eray Hanoğlu
|
|
147
122
|
|
|
148
|
-
###
|
|
123
|
+
### [v5.3.2](https://github.com/panates/valgen/compare/v5.3.1...v5.3.2) - 18 May 2024
|
|
149
124
|
|
|
150
|
-
|
|
125
|
+
#### 💬 General Changes
|
|
151
126
|
|
|
152
|
-
|
|
153
|
-
|
|
127
|
+
- Updated dependencies @Eray Hanoğlu
|
|
128
|
+
- Fixed coveralls token @Eray Hanoğlu
|
|
154
129
|
|
|
155
|
-
###
|
|
130
|
+
### [v5.3.1](https://github.com/panates/valgen/compare/v5.3.0...v5.3.1) - 18 May 2024
|
|
156
131
|
|
|
157
|
-
|
|
158
|
-
* Updated dependencies ([`636ce75`](https://github.com/panates/valgen/commit/636ce759e83e765661e7c5c8730c6b824076d344))
|
|
132
|
+
#### 💬 General Changes
|
|
159
133
|
|
|
160
|
-
|
|
161
|
-
|
|
134
|
+
- Reorganized many rules @Eray Hanoğlu
|
|
135
|
+
- Updated code documentation @Eray Hanoğlu
|
|
136
|
+
- Fixed rule name @Eray Hanoğlu
|
|
162
137
|
|
|
163
|
-
###
|
|
138
|
+
### [v5.3.0](https://github.com/panates/valgen/compare/v5.2.2...v5.3.0) - 6 May 2024
|
|
164
139
|
|
|
165
|
-
|
|
140
|
+
#### 💬 General Changes
|
|
166
141
|
|
|
167
|
-
|
|
168
|
-
[2024-01-04]
|
|
142
|
+
- Added validation generation option to enable coercing by default. @Eray Hanoğlu
|
|
169
143
|
|
|
170
|
-
###
|
|
144
|
+
### [v5.2.2](https://github.com/panates/valgen/compare/v5.2.1...v5.2.2) - 29 March 2024
|
|
171
145
|
|
|
172
|
-
|
|
146
|
+
#### 💬 General Changes
|
|
173
147
|
|
|
174
|
-
|
|
175
|
-
|
|
148
|
+
- Updated dependencies @Eray Hanoğlu
|
|
149
|
+
- Updated dependencies @Eray Hanoğlu
|
|
176
150
|
|
|
177
|
-
###
|
|
151
|
+
### [v5.2.1](https://github.com/panates/valgen/compare/v5.2.0...v5.2.1) - 27 March 2024
|
|
178
152
|
|
|
179
|
-
|
|
153
|
+
#### 💬 General Changes
|
|
180
154
|
|
|
181
|
-
|
|
182
|
-
[2023-12-23]
|
|
155
|
+
- Updated dependencies @Eray Hanoğlu
|
|
183
156
|
|
|
184
|
-
###
|
|
157
|
+
### [v5.2.0](https://github.com/panates/valgen/compare/v5.1.0...v5.2.0) - 4 January 2024
|
|
185
158
|
|
|
186
|
-
|
|
187
|
-
* Moved all validator factories into "factories" namespace, ([`2ac5abd`](https://github.com/panates/valgen/commit/2ac5abd7f2097de4ec769bcc55034636142ee598))
|
|
159
|
+
#### 💬 General Changes
|
|
188
160
|
|
|
189
|
-
|
|
190
|
-
[2023-12-21]
|
|
161
|
+
- Now validator options persist in context @Eray Hanoğlu
|
|
191
162
|
|
|
192
|
-
###
|
|
163
|
+
### [v5.1.0](https://github.com/panates/valgen/compare/v5.0.1...v5.1.0) - 23 December 2023
|
|
193
164
|
|
|
194
|
-
|
|
165
|
+
#### 💬 General Changes
|
|
195
166
|
|
|
196
|
-
|
|
197
|
-
[2023-12-08]
|
|
167
|
+
- Moved from "dayjs" to "date-fns" @Eray Hanoğlu
|
|
198
168
|
|
|
199
|
-
###
|
|
169
|
+
### [v5.0.1](https://github.com/panates/valgen/compare/v5.0.0...v5.0.1) - 23 December 2023
|
|
200
170
|
|
|
201
|
-
|
|
202
|
-
* Pass "_this" parameter to preValidation and postValidation methods ([`bdb6a97`](https://github.com/panates/valgen/commit/bdb6a97ed50b538fad97ed1fb2161f8665647214))
|
|
171
|
+
#### 💬 General Changes
|
|
203
172
|
|
|
204
|
-
|
|
205
|
-
|
|
173
|
+
- Added new rules @Eray Hanoğlu
|
|
174
|
+
- Moved all validator factories into "factories" namespace, @Eray Hanoğlu
|
|
206
175
|
|
|
207
|
-
|
|
176
|
+
## [v5.0.0](https://github.com/panates/valgen/compare/v4.3.2...v5.0.0) - 21 December 2023
|
|
208
177
|
|
|
209
|
-
|
|
178
|
+
#### 💬 General Changes
|
|
210
179
|
|
|
211
|
-
|
|
212
|
-
[2023-12-02]
|
|
180
|
+
- Moved all validator factories into "factories" namespace, @Eray Hanoğlu
|
|
213
181
|
|
|
214
|
-
###
|
|
182
|
+
### [v4.3.2](https://github.com/panates/valgen/compare/v4.3.1...v4.3.2) - 8 December 2023
|
|
215
183
|
|
|
216
|
-
|
|
217
|
-
* Added [preValidation] and [postValidation] to isObject rule ([`2f8351d`](https://github.com/panates/valgen/commit/2f8351d10fd1a9cc78577c52b37681319f3d28b2))
|
|
184
|
+
#### 💬 General Changes
|
|
218
185
|
|
|
219
|
-
|
|
220
|
-
|
|
186
|
+
- Updated dependenices @Eray Hanoğlu
|
|
187
|
+
- Pass "_this" parameter to preValidation and postValidation methods @Eray Hanoğlu
|
|
221
188
|
|
|
222
|
-
###
|
|
189
|
+
### [v4.3.1](https://github.com/panates/valgen/compare/v4.3.0...v4.3.1) - 4 December 2023
|
|
223
190
|
|
|
224
|
-
|
|
191
|
+
#### 💬 General Changes
|
|
225
192
|
|
|
226
|
-
|
|
227
|
-
[2023-11-20]
|
|
193
|
+
- Made preValidation and postValidation static @Eray Hanoğlu
|
|
228
194
|
|
|
229
|
-
###
|
|
195
|
+
### [v4.3.0](https://github.com/panates/valgen/compare/v4.2.5...v4.3.0) - 2 December 2023
|
|
230
196
|
|
|
231
|
-
|
|
197
|
+
#### 💬 General Changes
|
|
232
198
|
|
|
233
|
-
|
|
234
|
-
[
|
|
199
|
+
- Updated dependencies @Eray Hanoğlu
|
|
200
|
+
- Added [preValidation] and [postValidation] to isObject rule @Eray Hanoğlu
|
|
235
201
|
|
|
236
|
-
###
|
|
202
|
+
### [v4.2.5](https://github.com/panates/valgen/compare/v4.2.4...v4.2.5) - 27 November 2023
|
|
237
203
|
|
|
238
|
-
|
|
204
|
+
#### 💬 General Changes
|
|
239
205
|
|
|
240
|
-
|
|
241
|
-
[2023-11-15]
|
|
206
|
+
- Fixed isArray error location property. @Eray Hanoğlu
|
|
242
207
|
|
|
243
|
-
###
|
|
208
|
+
### [v4.2.4](https://github.com/panates/valgen/compare/v4.2.3...v4.2.4) - 20 November 2023
|
|
244
209
|
|
|
245
|
-
|
|
210
|
+
#### 💬 General Changes
|
|
246
211
|
|
|
247
|
-
|
|
248
|
-
[2023-11-15]
|
|
212
|
+
- Added json parsing feature to isObject validator @Eray Hanoğlu
|
|
249
213
|
|
|
250
|
-
###
|
|
214
|
+
### [v4.2.3](https://github.com/panates/valgen/compare/v4.2.2...v4.2.3) - 20 November 2023
|
|
251
215
|
|
|
252
|
-
|
|
216
|
+
#### 💬 General Changes
|
|
253
217
|
|
|
254
|
-
|
|
255
|
-
[2023-11-15]
|
|
218
|
+
- Optimized error messages @Eray Hanoğlu
|
|
256
219
|
|
|
257
|
-
###
|
|
220
|
+
### [v4.2.2](https://github.com/panates/valgen/compare/v4.2.1...v4.2.2) - 15 November 2023
|
|
258
221
|
|
|
259
|
-
|
|
260
|
-
* Added test for "label" option ([`162f41a`](https://github.com/panates/valgen/commit/162f41ac36762a146718c3efc4784bb33f48c955))
|
|
222
|
+
#### 💬 General Changes
|
|
261
223
|
|
|
262
|
-
|
|
263
|
-
[2023-10-31]
|
|
224
|
+
- Changed "trim" option @Eray Hanoğlu
|
|
264
225
|
|
|
265
|
-
###
|
|
226
|
+
### [v4.2.1](https://github.com/panates/valgen/compare/v4.2.0...v4.2.1) - 15 November 2023
|
|
266
227
|
|
|
267
|
-
|
|
228
|
+
#### 💬 General Changes
|
|
268
229
|
|
|
269
|
-
|
|
270
|
-
[2023-10-24]
|
|
230
|
+
- Fixed generating invalid date string @Eray Hanoğlu
|
|
271
231
|
|
|
272
|
-
###
|
|
232
|
+
### [v4.2.0](https://github.com/panates/valgen/compare/v4.1.0...v4.2.0) - 15 November 2023
|
|
273
233
|
|
|
274
|
-
|
|
234
|
+
#### 💬 General Changes
|
|
275
235
|
|
|
276
|
-
|
|
277
|
-
|
|
236
|
+
- Removed "format" option and added "precision" option to isDate validator @Eray Hanoğlu
|
|
237
|
+
- Added test for "label" option @Eray Hanoğlu
|
|
278
238
|
|
|
279
|
-
###
|
|
239
|
+
### [v4.1.0](https://github.com/panates/valgen/compare/v4.0.1...v4.1.0) - 31 October 2023
|
|
280
240
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
241
|
+
#### 💬 General Changes
|
|
242
|
+
|
|
243
|
+
- Updated validation messages. @Eray Hanoğlu
|
|
244
|
+
|
|
245
|
+
### [v4.0.1](https://github.com/panates/valgen/compare/v4.0.0...v4.0.1) - 24 October 2023
|
|
246
|
+
|
|
247
|
+
#### 💬 General Changes
|
|
248
|
+
|
|
249
|
+
- Added "coerce" option to isNull and isUndefined rules @Eray Hanoğlu
|
|
250
|
+
|
|
251
|
+
## [v4.0.0](https://github.com/panates/valgen/compare/v3.2.1...v4.0.0) - 17 August 2023
|
|
252
|
+
|
|
253
|
+
#### 💬 General Changes
|
|
254
|
+
|
|
255
|
+
- Initial release of v4.0.0-alpha.1 @Eray Hanoğlu
|
|
256
|
+
- Implemented all initial validators and tests @Eray Hanoğlu
|
|
257
|
+
- Updated dependencies @Eray Hanoğlu
|
|
258
|
+
- Better error handling @Eray Hanoğlu
|
|
259
|
+
- Updated deps @Eray Hanoğlu
|
|
260
|
+
- Added isBigint validator @Eray Hanoğlu
|
|
261
|
+
- Fixed isObject coerce issue @Eray Hanoğlu
|
|
262
|
+
- Improved isDateString @Eray Hanoğlu
|
|
263
|
+
- Updated dayjs @Eray Hanoğlu
|
|
264
|
+
- Updated deps @Eray Hanoğlu
|
|
265
|
+
- Updated deps @Eray Hanoğlu
|
|
266
|
+
- Fixed isObject coerce issue @Eray Hanoğlu
|
|
@@ -63,38 +63,46 @@ function isNotEmpty(options) {
|
|
|
63
63
|
context.fail(_this, `Value must not be empty`, input);
|
|
64
64
|
return input;
|
|
65
65
|
}
|
|
66
|
-
else if (
|
|
67
|
-
if (
|
|
68
|
-
context.fail(_this, `
|
|
69
|
-
return input;
|
|
70
|
-
}
|
|
71
|
-
else if (input instanceof Set) {
|
|
72
|
-
if (!input.size)
|
|
73
|
-
context.fail(_this, `Set must not be empty`, input);
|
|
74
|
-
return input;
|
|
75
|
-
}
|
|
76
|
-
else if (input instanceof Map) {
|
|
77
|
-
if (!input.size)
|
|
78
|
-
context.fail(_this, `Map must not be empty`, input);
|
|
79
|
-
return input;
|
|
80
|
-
}
|
|
81
|
-
else if (Buffer.isBuffer(input)) {
|
|
82
|
-
if (!input.length)
|
|
83
|
-
context.fail(_this, `Buffer must not be empty`, input);
|
|
84
|
-
return input;
|
|
85
|
-
}
|
|
86
|
-
else if (input instanceof ArrayBuffer) {
|
|
87
|
-
if (!input.byteLength)
|
|
88
|
-
context.fail(_this, `ArrayBuffer must not be empty`, input);
|
|
66
|
+
else if (typeof input === 'number') {
|
|
67
|
+
if (Number.isNaN(input))
|
|
68
|
+
context.fail(_this, `Value must not be NaN`, input);
|
|
89
69
|
return input;
|
|
90
70
|
}
|
|
91
71
|
else if (typeof input === 'object') {
|
|
92
|
-
if (input
|
|
72
|
+
if (Array.isArray(input)) {
|
|
73
|
+
if (!input.length)
|
|
74
|
+
context.fail(_this, `Array must not be empty`, input);
|
|
93
75
|
return input;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
76
|
+
}
|
|
77
|
+
else if (input instanceof Set) {
|
|
78
|
+
if (!input.size)
|
|
79
|
+
context.fail(_this, `Set must not be empty`, input);
|
|
80
|
+
return input;
|
|
81
|
+
}
|
|
82
|
+
else if (input instanceof Map) {
|
|
83
|
+
if (!input.size)
|
|
84
|
+
context.fail(_this, `Map must not be empty`, input);
|
|
85
|
+
return input;
|
|
86
|
+
}
|
|
87
|
+
else if (Buffer.isBuffer(input)) {
|
|
88
|
+
if (!input.length)
|
|
89
|
+
context.fail(_this, `Buffer must not be empty`, input);
|
|
90
|
+
return input;
|
|
91
|
+
}
|
|
92
|
+
else if (input instanceof ArrayBuffer) {
|
|
93
|
+
if (!input.byteLength)
|
|
94
|
+
context.fail(_this, `ArrayBuffer must not be empty`, input);
|
|
95
|
+
return input;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
if (input instanceof Date)
|
|
99
|
+
return input;
|
|
100
|
+
if (!Object.keys(input).length)
|
|
101
|
+
context.fail(_this, `Object must not be empty`, input);
|
|
102
|
+
return input;
|
|
103
|
+
}
|
|
97
104
|
}
|
|
105
|
+
return input;
|
|
98
106
|
}
|
|
99
107
|
context.fail(_this, `Value must not be empty`, input);
|
|
100
108
|
return input;
|
|
@@ -59,38 +59,46 @@ export function isNotEmpty(options) {
|
|
|
59
59
|
context.fail(_this, `Value must not be empty`, input);
|
|
60
60
|
return input;
|
|
61
61
|
}
|
|
62
|
-
else if (
|
|
63
|
-
if (
|
|
64
|
-
context.fail(_this, `
|
|
65
|
-
return input;
|
|
66
|
-
}
|
|
67
|
-
else if (input instanceof Set) {
|
|
68
|
-
if (!input.size)
|
|
69
|
-
context.fail(_this, `Set must not be empty`, input);
|
|
70
|
-
return input;
|
|
71
|
-
}
|
|
72
|
-
else if (input instanceof Map) {
|
|
73
|
-
if (!input.size)
|
|
74
|
-
context.fail(_this, `Map must not be empty`, input);
|
|
75
|
-
return input;
|
|
76
|
-
}
|
|
77
|
-
else if (Buffer.isBuffer(input)) {
|
|
78
|
-
if (!input.length)
|
|
79
|
-
context.fail(_this, `Buffer must not be empty`, input);
|
|
80
|
-
return input;
|
|
81
|
-
}
|
|
82
|
-
else if (input instanceof ArrayBuffer) {
|
|
83
|
-
if (!input.byteLength)
|
|
84
|
-
context.fail(_this, `ArrayBuffer must not be empty`, input);
|
|
62
|
+
else if (typeof input === 'number') {
|
|
63
|
+
if (Number.isNaN(input))
|
|
64
|
+
context.fail(_this, `Value must not be NaN`, input);
|
|
85
65
|
return input;
|
|
86
66
|
}
|
|
87
67
|
else if (typeof input === 'object') {
|
|
88
|
-
if (input
|
|
68
|
+
if (Array.isArray(input)) {
|
|
69
|
+
if (!input.length)
|
|
70
|
+
context.fail(_this, `Array must not be empty`, input);
|
|
89
71
|
return input;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
72
|
+
}
|
|
73
|
+
else if (input instanceof Set) {
|
|
74
|
+
if (!input.size)
|
|
75
|
+
context.fail(_this, `Set must not be empty`, input);
|
|
76
|
+
return input;
|
|
77
|
+
}
|
|
78
|
+
else if (input instanceof Map) {
|
|
79
|
+
if (!input.size)
|
|
80
|
+
context.fail(_this, `Map must not be empty`, input);
|
|
81
|
+
return input;
|
|
82
|
+
}
|
|
83
|
+
else if (Buffer.isBuffer(input)) {
|
|
84
|
+
if (!input.length)
|
|
85
|
+
context.fail(_this, `Buffer must not be empty`, input);
|
|
86
|
+
return input;
|
|
87
|
+
}
|
|
88
|
+
else if (input instanceof ArrayBuffer) {
|
|
89
|
+
if (!input.byteLength)
|
|
90
|
+
context.fail(_this, `ArrayBuffer must not be empty`, input);
|
|
91
|
+
return input;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
if (input instanceof Date)
|
|
95
|
+
return input;
|
|
96
|
+
if (!Object.keys(input).length)
|
|
97
|
+
context.fail(_this, `Object must not be empty`, input);
|
|
98
|
+
return input;
|
|
99
|
+
}
|
|
93
100
|
}
|
|
101
|
+
return input;
|
|
94
102
|
}
|
|
95
103
|
context.fail(_this, `Value must not be empty`, input);
|
|
96
104
|
return input;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "valgen",
|
|
3
3
|
"description": "Fast runtime type validator, converter and io (encoding/decoding) library",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.14.0",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
@@ -58,5 +58,8 @@
|
|
|
58
58
|
"converter",
|
|
59
59
|
"transform",
|
|
60
60
|
"type"
|
|
61
|
-
]
|
|
61
|
+
],
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public"
|
|
64
|
+
}
|
|
62
65
|
}
|
package/types/core/index.d.ts
CHANGED
package/types/index.d.cts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as vg from './rules/index.js';
|
|
2
2
|
export * from './constants.js';
|
|
3
3
|
export * from './core/index.js';
|
|
4
|
-
export { IsObject } from './rules/type-rules/is-object.js';
|
|
4
|
+
export type { IsObject } from './rules/type-rules/is-object.js';
|
|
5
5
|
declare const isAny: import("./core/validator.js").Validator<any, any, import("./core/types.js").ExecutionOptions>;
|
|
6
6
|
declare const isArray: import("./core/validator.js").Validator<unknown[], unknown, import("./core/types.js").ExecutionOptions>;
|
|
7
7
|
declare const isBigint: import("./core/validator.js").Validator<bigint, unknown, import("./core/types.js").ExecutionOptions>;
|
|
8
8
|
declare const isBoolean: import("./core/validator.js").Validator<boolean | undefined, unknown, import("./core/types.js").ExecutionOptions>;
|
|
9
9
|
declare const isDate: import("./core/validator.js").Validator<Date, string | number | Date, import("./core/types.js").ExecutionOptions>;
|
|
10
10
|
declare const isDateString: import("./core/validator.js").Validator<string, string | number | Date, import("./core/types.js").ExecutionOptions>;
|
|
11
|
-
declare const isEmpty: import("./core/validator.js").Validator<
|
|
12
|
-
declare const isNotEmpty: import("./core/validator.js").Validator<
|
|
11
|
+
declare const isEmpty: import("./core/validator.js").Validator<any, any, import("./core/types.js").ExecutionOptions>;
|
|
12
|
+
declare const isNotEmpty: import("./core/validator.js").Validator<any, any, import("./core/types.js").ExecutionOptions>;
|
|
13
13
|
declare const isInteger: import("./core/validator.js").Validator<number, unknown, import("./core/types.js").ExecutionOptions>;
|
|
14
14
|
declare const isNull: import("./core/validator.js").Validator<null, unknown, import("./core/types.js").ExecutionOptions>;
|
|
15
15
|
declare const isNotNull: import("./core/validator.js").Validator<unknown, unknown, import("./core/types.js").ExecutionOptions>;
|
package/types/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as vg from './rules/index.js';
|
|
2
2
|
export * from './constants.js';
|
|
3
3
|
export * from './core/index.js';
|
|
4
|
-
export { IsObject } from './rules/type-rules/is-object.js';
|
|
4
|
+
export type { IsObject } from './rules/type-rules/is-object.js';
|
|
5
5
|
declare const isAny: import("./core/validator.js").Validator<any, any, import("./core/types.js").ExecutionOptions>;
|
|
6
6
|
declare const isArray: import("./core/validator.js").Validator<unknown[], unknown, import("./core/types.js").ExecutionOptions>;
|
|
7
7
|
declare const isBigint: import("./core/validator.js").Validator<bigint, unknown, import("./core/types.js").ExecutionOptions>;
|
|
8
8
|
declare const isBoolean: import("./core/validator.js").Validator<boolean | undefined, unknown, import("./core/types.js").ExecutionOptions>;
|
|
9
9
|
declare const isDate: import("./core/validator.js").Validator<Date, string | number | Date, import("./core/types.js").ExecutionOptions>;
|
|
10
10
|
declare const isDateString: import("./core/validator.js").Validator<string, string | number | Date, import("./core/types.js").ExecutionOptions>;
|
|
11
|
-
declare const isEmpty: import("./core/validator.js").Validator<
|
|
12
|
-
declare const isNotEmpty: import("./core/validator.js").Validator<
|
|
11
|
+
declare const isEmpty: import("./core/validator.js").Validator<any, any, import("./core/types.js").ExecutionOptions>;
|
|
12
|
+
declare const isNotEmpty: import("./core/validator.js").Validator<any, any, import("./core/types.js").ExecutionOptions>;
|
|
13
13
|
declare const isInteger: import("./core/validator.js").Validator<number, unknown, import("./core/types.js").ExecutionOptions>;
|
|
14
14
|
declare const isNull: import("./core/validator.js").Validator<null, unknown, import("./core/types.js").ExecutionOptions>;
|
|
15
15
|
declare const isNotNull: import("./core/validator.js").Validator<unknown, unknown, import("./core/types.js").ExecutionOptions>;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { type ValidationOptions } from '../../core/index.js';
|
|
2
|
-
type IsEmptyInput = string | any[] | object | Set<any> | Map<any, any>;
|
|
3
2
|
/**
|
|
4
3
|
* Checks if value is an empty. Value should be string, array, set, map or object
|
|
5
4
|
* @validator isEmpty
|
|
6
5
|
*/
|
|
7
|
-
export declare function isEmpty(options?: ValidationOptions): import("../../core/validator.js").Validator<
|
|
6
|
+
export declare function isEmpty(options?: ValidationOptions): import("../../core/validator.js").Validator<any, any, import("../../core/types.js").ExecutionOptions>;
|
|
8
7
|
/**
|
|
9
8
|
* Checks if value is a not empty. Value should be string, array, set, map or object
|
|
10
9
|
* @validator isNotEmpty
|
|
11
10
|
*/
|
|
12
|
-
export declare function isNotEmpty(options?: ValidationOptions): import("../../core/validator.js").Validator<
|
|
13
|
-
export {};
|
|
11
|
+
export declare function isNotEmpty(options?: ValidationOptions): import("../../core/validator.js").Validator<any, any, import("../../core/types.js").ExecutionOptions>;
|