@bedrockio/yada 1.1.2 → 1.2.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/README.md CHANGED
@@ -25,6 +25,7 @@ Concepts
25
25
  - [custom](#custom)
26
26
  - [default](#default)
27
27
  - [strip](#strip)
28
+ - [nullable](#nullable)
28
29
  - [message](#message)
29
30
  - [Validation Options](#validation-options)
30
31
  - [Error Messages](#error-messages)
@@ -553,6 +554,29 @@ const schema = yd.object({
553
554
  Arguments are identical to those passed to [custom](#custom). The field will be
554
555
  stripped out if the function returns a truthy value.
555
556
 
557
+ ### Nullable
558
+
559
+ The `nullable` field allows `null` to be passed for any value:
560
+
561
+ ```js
562
+ const schema = yd.string().nullable();
563
+ await schema.validate(null); // Allowed
564
+ ```
565
+
566
+ This is the equivalent of:
567
+
568
+ ```js
569
+ schema = yd.allow(schema, null);
570
+ ```
571
+
572
+ However it has two advantages. First it will correctly describe its
573
+ [OpenApi](#openapi) schema as `nullable`. It will also return the same type
574
+ schema, allowing chaining:
575
+
576
+ ```js
577
+ const schema = yd.string().nullable().trim();
578
+ ```
579
+
556
580
  ### Message
557
581
 
558
582
  The `message` method allows adding a custom message to schema or field. Note
@@ -86,6 +86,16 @@ class Schema {
86
86
  return this.assertEnum(set, false);
87
87
  }
88
88
 
89
+ /**
90
+ * Allow null. [Link](https://github.com/bedrockio/yada#nullable)
91
+ * @returns {this}
92
+ */
93
+ nullable() {
94
+ return this.clone({
95
+ nullable: true
96
+ });
97
+ }
98
+
89
99
  /**
90
100
  * @returns {this}
91
101
  */
@@ -133,7 +143,11 @@ class Schema {
133
143
  original: value
134
144
  };
135
145
  for (let assertion of this.assertions) {
136
- if (!assertion.required && value === undefined) {
146
+ if (value === undefined && !assertion.required) {
147
+ break;
148
+ } else if (value === null && options.nullable) {
149
+ break;
150
+ } else if (value === '' && !options.required && options.allowEmpty) {
137
151
  break;
138
152
  }
139
153
  try {
@@ -199,6 +213,7 @@ class Schema {
199
213
  ...tags,
200
214
  ...this.getAnyType(),
201
215
  ...this.getDefault(),
216
+ ...this.getNullable(),
202
217
  ...this.enumToOpenApi(),
203
218
  ...this.expandExtra(extra)
204
219
  };
@@ -226,8 +241,15 @@ class Schema {
226
241
  };
227
242
  }
228
243
  }
229
- inspect() {
230
- return JSON.stringify(this.toOpenApi(), null, 2);
244
+ getNullable() {
245
+ const {
246
+ nullable
247
+ } = this.meta;
248
+ if (nullable) {
249
+ return {
250
+ nullable: true
251
+ };
252
+ }
231
253
  }
232
254
  expandExtra(extra = {}) {
233
255
  const {
@@ -239,6 +261,9 @@ class Schema {
239
261
  }
240
262
  return rest;
241
263
  }
264
+ inspect() {
265
+ return JSON.stringify(this.toOpenApi(), null, 2);
266
+ }
242
267
 
243
268
  // Private
244
269
 
@@ -368,7 +393,9 @@ class Schema {
368
393
  };
369
394
  oneOf.push(forType);
370
395
  }
371
- forType.enum.push(entry);
396
+ if (forType.enum) {
397
+ forType.enum.push(entry);
398
+ }
372
399
  }
373
400
  }
374
401
  return {
@@ -14,16 +14,17 @@ class LocalizedError extends Error {
14
14
  }
15
15
  exports.LocalizedError = LocalizedError;
16
16
  class ValidationError extends Error {
17
+ static DEFAULT_MESSAGE = 'Validation failed.';
17
18
  constructor(arg, details = []) {
18
- super(getLocalizedMessage(arg));
19
+ super(getLocalizedMessage(arg) || ValidationError.DEFAULT_MESSAGE);
19
20
  this.type = 'validation';
20
21
  this.details = details;
21
22
  }
22
23
  toJSON() {
23
24
  const {
24
- message,
25
25
  details
26
26
  } = this;
27
+ const message = this.getMessage();
27
28
  return {
28
29
  type: this.type,
29
30
  ...(message && {
@@ -36,6 +37,18 @@ class ValidationError extends Error {
36
37
  })
37
38
  };
38
39
  }
40
+ getMessage() {
41
+ const {
42
+ message
43
+ } = this;
44
+ // @ts-ignore
45
+ const {
46
+ DEFAULT_MESSAGE
47
+ } = this.constructor;
48
+ if (message && message !== DEFAULT_MESSAGE) {
49
+ return message;
50
+ }
51
+ }
39
52
  getFullMessage(options) {
40
53
  return (0, _messages.getFullMessage)(this, {
41
54
  delimiter: ' ',
@@ -9,7 +9,7 @@ function getFullMessage(error, options) {
9
9
  const {
10
10
  delimiter = '\n'
11
11
  } = options;
12
- if (error.message) {
12
+ if (hasMessage(error)) {
13
13
  return getLabeledMessage(error, options);
14
14
  } else if (error.details?.length) {
15
15
  return error.details.map(error => {
@@ -20,6 +20,15 @@ function getFullMessage(error, options) {
20
20
  }).join(delimiter);
21
21
  }
22
22
  }
23
+ function hasMessage(error) {
24
+ let message;
25
+ if (error.getMessage) {
26
+ message = error.getMessage();
27
+ } else {
28
+ message = error.message;
29
+ }
30
+ return !!message;
31
+ }
23
32
  function getInnerPath(error, options) {
24
33
  const {
25
34
  path = []
@@ -39,6 +39,7 @@ class ObjectSchema extends _TypeSchema.default {
39
39
  const {
40
40
  fields,
41
41
  stripUnknown,
42
+ stripEmpty,
42
43
  expandDotSyntax
43
44
  } = options;
44
45
  if (obj) {
@@ -47,13 +48,17 @@ class ObjectSchema extends _TypeSchema.default {
47
48
  obj = expandDotProperties(obj);
48
49
  }
49
50
  for (let key of Object.keys(obj)) {
50
- if (!fields || key in fields) {
51
- result[key] = obj[key];
52
- } else if (!stripUnknown) {
51
+ const value = obj[key];
52
+ const isUnknown = !!fields && !(key in fields);
53
+ if (value === '' && stripEmpty || isUnknown && stripUnknown) {
54
+ continue;
55
+ } else if (isUnknown) {
53
56
  throw new _errors.LocalizedError('Unknown field "{key}".', {
54
57
  key,
55
58
  type: 'field'
56
59
  });
60
+ } else {
61
+ result[key] = obj[key];
57
62
  }
58
63
  }
59
64
  return result;
@@ -69,11 +74,13 @@ class ObjectSchema extends _TypeSchema.default {
69
74
  path = []
70
75
  } = options;
71
76
  const {
72
- strip
77
+ strip,
78
+ required
73
79
  } = schema.meta;
74
80
  const val = obj[key];
75
81
  options = {
76
82
  ...options,
83
+ required,
77
84
  path: [...path, key]
78
85
  };
79
86
  if (strip && strip(val, options)) {
@@ -14,10 +14,13 @@ const PHONE_REG = /^\+\d{1,3}\d{3,14}$/;
14
14
  const PHONE_DESCRIPTION = 'A phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format.';
15
15
  class StringSchema extends _TypeSchema.default {
16
16
  constructor() {
17
- super(String);
17
+ super(String, {
18
+ allowEmpty: true
19
+ });
18
20
  this.assert('type', (val, options) => {
19
21
  const {
20
22
  cast,
23
+ required,
21
24
  allowEmpty
22
25
  } = options;
23
26
  if (cast && typeof val !== 'string') {
@@ -25,7 +28,7 @@ class StringSchema extends _TypeSchema.default {
25
28
  }
26
29
  if (typeof val !== 'string') {
27
30
  throw new _errors.LocalizedError('Must be a string.');
28
- } else if (!allowEmpty && val === '') {
31
+ } else if ((required || !allowEmpty) && val === '') {
29
32
  throw new _errors.LocalizedError('String may not be empty.');
30
33
  }
31
34
  return val;
@@ -45,15 +48,6 @@ class StringSchema extends _TypeSchema.default {
45
48
  });
46
49
  }
47
50
 
48
- /**
49
- * @returns {this}
50
- */
51
- allowEmpty() {
52
- return this.options({
53
- allowEmpty: true
54
- });
55
- }
56
-
57
51
  /**
58
52
  * @param {number} length
59
53
  */
@@ -390,10 +384,10 @@ class StringSchema extends _TypeSchema.default {
390
384
  } = this.meta;
391
385
  return {
392
386
  ...super.toOpenApi(extra),
393
- ...(min != null && {
387
+ ...(min && {
394
388
  minLength: min
395
389
  }),
396
- ...(max != null && {
390
+ ...(max && {
397
391
  maxLength: max
398
392
  })
399
393
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrockio/yada",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Validation library inspired by Joi.",
5
5
  "scripts": {
6
6
  "test": "jest",
package/src/Schema.js CHANGED
@@ -82,6 +82,14 @@ export default class Schema {
82
82
  return this.assertEnum(set, false);
83
83
  }
84
84
 
85
+ /**
86
+ * Allow null. [Link](https://github.com/bedrockio/yada#nullable)
87
+ * @returns {this}
88
+ */
89
+ nullable() {
90
+ return this.clone({ nullable: true });
91
+ }
92
+
85
93
  /**
86
94
  * @returns {this}
87
95
  */
@@ -128,9 +136,14 @@ export default class Schema {
128
136
  };
129
137
 
130
138
  for (let assertion of this.assertions) {
131
- if (!assertion.required && value === undefined) {
139
+ if (value === undefined && !assertion.required) {
140
+ break;
141
+ } else if (value === null && options.nullable) {
142
+ break;
143
+ } else if (value === '' && !options.required && options.allowEmpty) {
132
144
  break;
133
145
  }
146
+
134
147
  try {
135
148
  const result = await this.runAssertion(assertion, value, options);
136
149
  if (result !== undefined) {
@@ -189,6 +202,7 @@ export default class Schema {
189
202
  ...tags,
190
203
  ...this.getAnyType(),
191
204
  ...this.getDefault(),
205
+ ...this.getNullable(),
192
206
  ...this.enumToOpenApi(),
193
207
  ...this.expandExtra(extra),
194
208
  };
@@ -214,8 +228,13 @@ export default class Schema {
214
228
  }
215
229
  }
216
230
 
217
- inspect() {
218
- return JSON.stringify(this.toOpenApi(), null, 2);
231
+ getNullable() {
232
+ const { nullable } = this.meta;
233
+ if (nullable) {
234
+ return {
235
+ nullable: true,
236
+ };
237
+ }
219
238
  }
220
239
 
221
240
  expandExtra(extra = {}) {
@@ -226,6 +245,10 @@ export default class Schema {
226
245
  return rest;
227
246
  }
228
247
 
248
+ inspect() {
249
+ return JSON.stringify(this.toOpenApi(), null, 2);
250
+ }
251
+
229
252
  // Private
230
253
 
231
254
  /**
@@ -352,7 +375,9 @@ export default class Schema {
352
375
  };
353
376
  oneOf.push(forType);
354
377
  }
355
- forType.enum.push(entry);
378
+ if (forType.enum) {
379
+ forType.enum.push(entry);
380
+ }
356
381
  }
357
382
  }
358
383
  return { oneOf };
package/src/errors.js CHANGED
@@ -8,14 +8,17 @@ export class LocalizedError extends Error {
8
8
  }
9
9
 
10
10
  export class ValidationError extends Error {
11
+ static DEFAULT_MESSAGE = 'Validation failed.';
12
+
11
13
  constructor(arg, details = []) {
12
- super(getLocalizedMessage(arg));
14
+ super(getLocalizedMessage(arg) || ValidationError.DEFAULT_MESSAGE);
13
15
  this.type = 'validation';
14
16
  this.details = details;
15
17
  }
16
18
 
17
19
  toJSON() {
18
- const { message, details } = this;
20
+ const { details } = this;
21
+ const message = this.getMessage();
19
22
  return {
20
23
  type: this.type,
21
24
  ...(message && {
@@ -29,6 +32,15 @@ export class ValidationError extends Error {
29
32
  };
30
33
  }
31
34
 
35
+ getMessage() {
36
+ const { message } = this;
37
+ // @ts-ignore
38
+ const { DEFAULT_MESSAGE } = this.constructor;
39
+ if (message && message !== DEFAULT_MESSAGE) {
40
+ return message;
41
+ }
42
+ }
43
+
32
44
  getFullMessage(options) {
33
45
  return getFullMessage(this, {
34
46
  delimiter: ' ',
package/src/messages.js CHANGED
@@ -2,7 +2,7 @@ import { localize } from './localization';
2
2
 
3
3
  export function getFullMessage(error, options) {
4
4
  const { delimiter = '\n' } = options;
5
- if (error.message) {
5
+ if (hasMessage(error)) {
6
6
  return getLabeledMessage(error, options);
7
7
  } else if (error.details?.length) {
8
8
  return error.details
@@ -16,6 +16,16 @@ export function getFullMessage(error, options) {
16
16
  }
17
17
  }
18
18
 
19
+ function hasMessage(error) {
20
+ let message;
21
+ if (error.getMessage) {
22
+ message = error.getMessage();
23
+ } else {
24
+ message = error.message;
25
+ }
26
+ return !!message;
27
+ }
28
+
19
29
  function getInnerPath(error, options) {
20
30
  const { path = [] } = options;
21
31
  if (error.field) {
package/src/object.js CHANGED
@@ -25,20 +25,25 @@ class ObjectSchema extends TypeSchema {
25
25
  }
26
26
  });
27
27
  this.transform((obj, options) => {
28
- const { fields, stripUnknown, expandDotSyntax } = options;
28
+ const { fields, stripUnknown, stripEmpty, expandDotSyntax } = options;
29
29
  if (obj) {
30
30
  const result = {};
31
31
  if (expandDotSyntax) {
32
32
  obj = expandDotProperties(obj);
33
33
  }
34
34
  for (let key of Object.keys(obj)) {
35
- if (!fields || key in fields) {
36
- result[key] = obj[key];
37
- } else if (!stripUnknown) {
35
+ const value = obj[key];
36
+ const isUnknown = !!fields && !(key in fields);
37
+
38
+ if ((value === '' && stripEmpty) || (isUnknown && stripUnknown)) {
39
+ continue;
40
+ } else if (isUnknown) {
38
41
  throw new LocalizedError('Unknown field "{key}".', {
39
42
  key,
40
43
  type: 'field',
41
44
  });
45
+ } else {
46
+ result[key] = obj[key];
42
47
  }
43
48
  }
44
49
  return result;
@@ -51,11 +56,12 @@ class ObjectSchema extends TypeSchema {
51
56
  this.assert('field', async (obj, options) => {
52
57
  if (obj) {
53
58
  const { path = [] } = options;
54
- const { strip } = schema.meta;
59
+ const { strip, required } = schema.meta;
55
60
  const val = obj[key];
56
61
 
57
62
  options = {
58
63
  ...options,
64
+ required,
59
65
  path: [...path, key],
60
66
  };
61
67
 
package/src/string.js CHANGED
@@ -18,15 +18,15 @@ const PHONE_DESCRIPTION =
18
18
 
19
19
  class StringSchema extends TypeSchema {
20
20
  constructor() {
21
- super(String);
21
+ super(String, { allowEmpty: true });
22
22
  this.assert('type', (val, options) => {
23
- const { cast, allowEmpty } = options;
23
+ const { cast, required, allowEmpty } = options;
24
24
  if (cast && typeof val !== 'string') {
25
25
  val = String(val);
26
26
  }
27
27
  if (typeof val !== 'string') {
28
28
  throw new LocalizedError('Must be a string.');
29
- } else if (!allowEmpty && val === '') {
29
+ } else if ((required || !allowEmpty) && val === '') {
30
30
  throw new LocalizedError('String may not be empty.');
31
31
  }
32
32
  return val;
@@ -44,13 +44,6 @@ class StringSchema extends TypeSchema {
44
44
  });
45
45
  }
46
46
 
47
- /**
48
- * @returns {this}
49
- */
50
- allowEmpty() {
51
- return this.options({ allowEmpty: true });
52
- }
53
-
54
47
  /**
55
48
  * @param {number} length
56
49
  */
@@ -401,10 +394,10 @@ class StringSchema extends TypeSchema {
401
394
  const { min, max } = this.meta;
402
395
  return {
403
396
  ...super.toOpenApi(extra),
404
- ...(min != null && {
397
+ ...(min && {
405
398
  minLength: min,
406
399
  }),
407
- ...(max != null && {
400
+ ...(max && {
408
401
  maxLength: max,
409
402
  }),
410
403
  };
package/types/Schema.d.ts CHANGED
@@ -34,6 +34,11 @@ export default class Schema {
34
34
  * @returns {this}
35
35
  */
36
36
  reject(...set: any[]): this;
37
+ /**
38
+ * Allow null. [Link](https://github.com/bedrockio/yada#nullable)
39
+ * @returns {this}
40
+ */
41
+ nullable(): this;
37
42
  /**
38
43
  * @returns {this}
39
44
  */
@@ -69,8 +74,11 @@ export default class Schema {
69
74
  } | {
70
75
  default: any;
71
76
  };
72
- inspect(): string;
77
+ getNullable(): {
78
+ nullable: boolean;
79
+ };
73
80
  expandExtra(extra?: {}): {};
81
+ inspect(): string;
74
82
  /**
75
83
  * @returns {this}
76
84
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../src/Schema.js"],"names":[],"mappings":"AA2WA,4CAEC;AAhWD;IACE,uBAGC;IAFC,kBAAoB;IACpB,SAAgB;IAKlB;;OAEG;IACH,YAFa,IAAI,CAQhB;IAED;;;OAGG;IACH,mBAFa,IAAI,CAShB;IAED;;;;OAIG;IACH,sBAFa,IAAI,CAShB;IAED;;;;OAIG;IACH,mBAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,sBAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,uBAFa,IAAI,CAIhB;IAED;;OAEG;IACH,uBAFa,IAAI,CAIhB;IAED;;OAEG;IACH,gBAFa,IAAI,CAShB;IAED;;OAEG;IACH,+BAFa,IAAI,CAMhB;IAED;;OAEG;IACH,uBAFa,IAAI,CAIhB;IAED,iDA0CC;IAED;;OAEG;IACH,kBAFa,IAAI,CAOhB;IAED;;;OAGG;IACH,qBAFa,IAAI,CAMhB;IAED,2BAWC;IAED;;MAOC;IAED;;;;MASC;IAED,kBAEC;IAED,4BAMC;IAID;;OAEG;IACH,kCAFa,IAAI,CAiDhB;IAED;;OAEG;IACH,4BAFa,IAAI,CAUhB;IAED,oCAKC;IAED;;OAEG;IACH,oBAFa,IAAI,CAShB;IAED,gCAGC;IAED,qEAGC;IAED;;;;;;;;MAoCC;CACF"}
1
+ {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../src/Schema.js"],"names":[],"mappings":"AAoYA,4CAEC;AAzXD;IACE,uBAGC;IAFC,kBAAoB;IACpB,SAAgB;IAKlB;;OAEG;IACH,YAFa,IAAI,CAQhB;IAED;;;OAGG;IACH,mBAFa,IAAI,CAShB;IAED;;;;OAIG;IACH,sBAFa,IAAI,CAShB;IAED;;;;OAIG;IACH,mBAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,sBAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,uBAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,YAFa,IAAI,CAIhB;IAED;;OAEG;IACH,uBAFa,IAAI,CAIhB;IAED;;OAEG;IACH,gBAFa,IAAI,CAShB;IAED;;OAEG;IACH,+BAFa,IAAI,CAMhB;IAED;;OAEG;IACH,uBAFa,IAAI,CAIhB;IAED,iDA+CC;IAED;;OAEG;IACH,kBAFa,IAAI,CAOhB;IAED;;;OAGG;IACH,qBAFa,IAAI,CAMhB;IAED,2BAYC;IAED;;MAOC;IAED;;;;MASC;IAED;;MAOC;IAED,4BAMC;IAED,kBAEC;IAID;;OAEG;IACH,kCAFa,IAAI,CAiDhB;IAED;;OAEG;IACH,4BAFa,IAAI,CAUhB;IAED,oCAKC;IAED;;OAEG;IACH,oBAFa,IAAI,CAShB;IAED,gCAGC;IAED,qEAGC;IAED;;;;;;;;MAsCC;CACF"}
package/types/errors.d.ts CHANGED
@@ -3,6 +3,7 @@ export class LocalizedError extends Error {
3
3
  constructor(message: any, values?: {});
4
4
  }
5
5
  export class ValidationError extends Error {
6
+ static DEFAULT_MESSAGE: string;
6
7
  constructor(arg: any, details?: any[]);
7
8
  type: string;
8
9
  details: any[];
@@ -11,6 +12,7 @@ export class ValidationError extends Error {
11
12
  message: string;
12
13
  type: string;
13
14
  };
15
+ getMessage(): string;
14
16
  getFullMessage(options: any): any;
15
17
  }
16
18
  export class AssertionError extends ValidationError {
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.js"],"names":[],"mappings":"AA4HA,iDAEC;AA3HD;IACE,uCAEC;CACF;AAED;IACE,uCAIC;IAFC,aAAwB;IACxB,eAAsB;IAGxB;;;;MAaC;IAED,kCAKC;CACF;AAED;IACE,yCAGC;CACF;AAED;IACE,qCAIC;IADC,UAAgB;IAGlB,2BAEC;IAED;;;;;MAKC;CACF;AAED;IACE,uCAIC;IADC,YAAoB;IAGtB;;;;;MAKC;CACF;AAED;IACE,oDAIC;IADC,WAAkB;IAGpB;;;;;MAKC;CACF;AAED;IACE,oDAIC;IADC,WAAkB;IAGpB;;;;;MAKC;CACF;AAED;IACE,wCAGC;CACF;AAED;IACE,wCAGC;CACF"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.js"],"names":[],"mappings":"AAwIA,iDAEC;AAvID;IACE,uCAEC;CACF;AAED;IACE,+BAA8C;IAE9C,uCAIC;IAFC,aAAwB;IACxB,eAAsB;IAGxB;;;;MAcC;IAED,qBAOC;IAED,kCAKC;CACF;AAED;IACE,yCAGC;CACF;AAED;IACE,qCAIC;IADC,UAAgB;IAGlB,2BAEC;IAED;;;;;MAKC;CACF;AAED;IACE,uCAIC;IADC,YAAoB;IAGtB;;;;;MAKC;CACF;AAED;IACE,oDAIC;IADC,WAAkB;IAGpB;;;;;MAKC;CACF;AAED;IACE,oDAIC;IADC,WAAkB;IAGpB;;;;;MAKC;CACF;AAED;IACE,wCAGC;CACF;AAED;IACE,wCAGC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../src/object.js"],"names":[],"mappings":"AAiMA;;;;;;GAMG;AACH,uCAJW,SAAS,gBAMnB;;;;AAnMD;;GAEG;AAEH;IAME;;OAEG;IACH,cA+DC;IAED;;OAEG;IACH,kBAEC;IAED;;OAEG;IAEH,YAHW,SAAS,GAAC,MAAM,gBAkC1B;IAED;;OAEG;IACH,gBAFc,MAAM,kBAWnB;IAED;;OAEG;IACH,gBAFc,MAAM,kBAWnB;CAcF"}
1
+ {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../src/object.js"],"names":[],"mappings":"AAuMA;;;;;;GAMG;AACH,uCAJW,SAAS,gBAMnB;;;;AAzMD;;GAEG;AAEH;IAME;;OAEG;IACH,cAqEC;IAED;;OAEG;IACH,kBAEC;IAED;;OAEG;IAEH,YAHW,SAAS,GAAC,MAAM,gBAkC1B;IAED;;OAEG;IACH,gBAFc,MAAM,kBAWnB;IAED;;OAEG;IACH,gBAFc,MAAM,kBAWnB;CAcF"}
package/types/string.d.ts CHANGED
@@ -8,10 +8,6 @@ declare class StringSchema extends TypeSchema {
8
8
  * @returns {this}
9
9
  */
10
10
  required(): this;
11
- /**
12
- * @returns {this}
13
- */
14
- allowEmpty(): this;
15
11
  /**
16
12
  * @param {number} length
17
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.js"],"names":[],"mappings":"AA6ZA;;GAEG;AACH,iDAEC;AAhZD;IACE,cAcC;IAED;;OAEG;IACH,YAFa,IAAI,CAQhB;IAED;;OAEG;IACH,cAFa,IAAI,CAIhB;IAED;;OAEG;IACH,eAFW,MAAM,gBAUhB;IAED;;OAEG;IACH,YAFW,MAAM,gBAUhB;IAED;;OAEG;IACH,YAFW,MAAM,gBAUhB;IAED,qBAIC;IAED;;OAEG;IACH,mBAFW,OAAO,gBAYjB;IAED;;OAEG;IACH,mBAFW,OAAO,gBAYjB;IAED;;OAEG;IACH,WAFW,MAAM,gBAahB;IAED,sBAMC;IAED,sBAMC;IAED,oBAMC;IAED,oBAMC;IAED,qBAMC;IAED,sBAMC;IAED;;;OAGG;IACH;QAF6B,OAAO,GAAzB,OAAO;qBAQjB;IAED,2BAMC;IAED,mBAMC;IAED,wBAMC;IAED,uBAMC;IAED,oBAMC;IAED,qBAOC;IAED,uBAMC;IAED;;OAEG;IACH,oBAFW,MAAM,gBAQhB;IAED,wBAMC;IAED;;;;;;;OAOG;IACH;QAN4B,SAAS,GAA1B,MAAM;QACW,UAAU,GAA3B,MAAM;QACW,UAAU,GAA3B,MAAM;QACW,YAAY,GAA7B,MAAM;QACW,YAAY,GAA7B,MAAM;qBA+BhB;IAED;;;;;;;;;;;OAWG;IACH;QAV6B,gBAAgB,GAAlC,OAAO;QACW,sBAAsB,GAAxC,OAAO;QACW,YAAY,GAA9B,OAAO;QACW,YAAY,GAA9B,OAAO;QACW,4BAA4B,GAA9C,OAAO;QACW,eAAe,GAAjC,OAAO;QACW,sBAAsB,GAAxC,OAAO;QACW,eAAe,GAAjC,OAAO;QACY,SAAS,GAA5B,MAAM,EAAE;qBAQlB;IAED;;;;;;;;OAQG;IACH;QAP6B,WAAW,GAA7B,OAAO;QACW,iBAAiB,GAAnC,OAAO;QACW,kBAAkB,GAApC,OAAO;QACW,iBAAiB,GAAnC,OAAO;QACW,cAAc,GAAhC,OAAO;QACW,iBAAiB,GAAnC,OAAO;qBAQjB;IAED;;OAEG;IACH,eAFW,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,gBAQ3B;IAED,oBAMC;IAED,oBAMC;IAED,sBAMC;IAED,sBAMC;CAcF"}
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.js"],"names":[],"mappings":"AAsZA;;GAEG;AACH,iDAEC;AAzYD;IACE,cAcC;IAED;;OAEG;IACH,YAFa,IAAI,CAQhB;IAED;;OAEG;IACH,eAFW,MAAM,gBAUhB;IAED;;OAEG;IACH,YAFW,MAAM,gBAUhB;IAED;;OAEG;IACH,YAFW,MAAM,gBAUhB;IAED,qBAIC;IAED;;OAEG;IACH,mBAFW,OAAO,gBAYjB;IAED;;OAEG;IACH,mBAFW,OAAO,gBAYjB;IAED;;OAEG;IACH,WAFW,MAAM,gBAahB;IAED,sBAMC;IAED,sBAMC;IAED,oBAMC;IAED,oBAMC;IAED,qBAMC;IAED,sBAMC;IAED;;;OAGG;IACH;QAF6B,OAAO,GAAzB,OAAO;qBAQjB;IAED,2BAMC;IAED,mBAMC;IAED,wBAMC;IAED,uBAMC;IAED,oBAMC;IAED,qBAOC;IAED,uBAMC;IAED;;OAEG;IACH,oBAFW,MAAM,gBAQhB;IAED,wBAMC;IAED;;;;;;;OAOG;IACH;QAN4B,SAAS,GAA1B,MAAM;QACW,UAAU,GAA3B,MAAM;QACW,UAAU,GAA3B,MAAM;QACW,YAAY,GAA7B,MAAM;QACW,YAAY,GAA7B,MAAM;qBA+BhB;IAED;;;;;;;;;;;OAWG;IACH;QAV6B,gBAAgB,GAAlC,OAAO;QACW,sBAAsB,GAAxC,OAAO;QACW,YAAY,GAA9B,OAAO;QACW,YAAY,GAA9B,OAAO;QACW,4BAA4B,GAA9C,OAAO;QACW,eAAe,GAAjC,OAAO;QACW,sBAAsB,GAAxC,OAAO;QACW,eAAe,GAAjC,OAAO;QACY,SAAS,GAA5B,MAAM,EAAE;qBAQlB;IAED;;;;;;;;OAQG;IACH;QAP6B,WAAW,GAA7B,OAAO;QACW,iBAAiB,GAAnC,OAAO;QACW,kBAAkB,GAApC,OAAO;QACW,iBAAiB,GAAnC,OAAO;QACW,cAAc,GAAhC,OAAO;QACW,iBAAiB,GAAnC,OAAO;qBAQjB;IAED;;OAEG;IACH,eAFW,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,gBAQ3B;IAED,oBAMC;IAED,oBAMC;IAED,sBAMC;IAED,sBAMC;CAcF"}