joi 17.13.3 → 18.0.1
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/dist/joi-browser.min.js +1 -1
- package/lib/annotate.js +2 -2
- package/lib/base.js +151 -74
- package/lib/cache.js +3 -4
- package/lib/common.js +1 -2
- package/lib/compile.js +23 -23
- package/lib/extend.js +10 -11
- package/lib/index.d.ts +2627 -2333
- package/lib/index.js +9 -10
- package/lib/manifest.js +15 -16
- package/lib/messages.js +10 -11
- package/lib/modify.js +10 -10
- package/lib/ref.js +15 -17
- package/lib/state.js +4 -5
- package/lib/template.js +8 -10
- package/lib/trace.js +4 -4
- package/lib/types/alternatives.js +33 -10
- package/lib/types/any.js +5 -5
- package/lib/types/array.js +32 -10
- package/lib/types/binary.js +3 -3
- package/lib/types/boolean.js +3 -3
- package/lib/types/date.js +3 -3
- package/lib/types/function.js +4 -4
- package/lib/types/keys.js +39 -16
- package/lib/types/link.js +11 -11
- package/lib/types/number.js +4 -4
- package/lib/types/string.js +84 -52
- package/lib/types/symbol.js +5 -5
- package/lib/validator.js +26 -18
- package/lib/values.js +4 -5
- package/package.json +21 -12
package/lib/types/any.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { assert } = require('@hapi/hoek');
|
|
4
4
|
|
|
5
5
|
const Base = require('../base');
|
|
6
6
|
const Common = require('../common');
|
|
@@ -36,8 +36,8 @@ module.exports = Base.extend({
|
|
|
36
36
|
custom: {
|
|
37
37
|
method(method, description) {
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
assert(typeof method === 'function', 'Method must be a function');
|
|
40
|
+
assert(description === undefined || description && typeof description === 'string', 'Description must be a non-empty string');
|
|
41
41
|
|
|
42
42
|
return this.$_addRule({ name: 'custom', args: { method, description } });
|
|
43
43
|
},
|
|
@@ -64,7 +64,7 @@ module.exports = Base.extend({
|
|
|
64
64
|
shared: {
|
|
65
65
|
method(schema) {
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
assert(Common.isSchema(schema) && schema._flags.id, 'Schema must be a schema with an id');
|
|
68
68
|
|
|
69
69
|
const obj = this.clone();
|
|
70
70
|
obj.$_terms.shared = obj.$_terms.shared || [];
|
|
@@ -77,7 +77,7 @@ module.exports = Base.extend({
|
|
|
77
77
|
warning: {
|
|
78
78
|
method(code, local) {
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
assert(code && typeof code === 'string', 'Invalid warning code');
|
|
81
81
|
|
|
82
82
|
return this.$_addRule({ name: 'warning', args: { code, local }, warn: true });
|
|
83
83
|
},
|
package/lib/types/array.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const DeepEqual = require('@hapi/hoek/lib/deepEqual');
|
|
5
|
-
const Reach = require('@hapi/hoek/lib/reach');
|
|
3
|
+
const { assert, deepEqual, reach } = require('@hapi/hoek');
|
|
6
4
|
|
|
7
5
|
const Any = require('./any');
|
|
8
6
|
const Common = require('../common');
|
|
@@ -417,7 +415,7 @@ module.exports = Any.extend({
|
|
|
417
415
|
method(enabled) {
|
|
418
416
|
|
|
419
417
|
const value = enabled === undefined ? true : !!enabled;
|
|
420
|
-
|
|
418
|
+
assert(!value || !this._flags._arrayItems, 'Cannot specify single rule when array has array items');
|
|
421
419
|
|
|
422
420
|
return this.$_setFlag('single', value);
|
|
423
421
|
}
|
|
@@ -434,7 +432,7 @@ module.exports = Any.extend({
|
|
|
434
432
|
|
|
435
433
|
if (options.by) {
|
|
436
434
|
settings.by = Compile.ref(options.by, { ancestor: 0 });
|
|
437
|
-
|
|
435
|
+
assert(!settings.by.ancestor, 'Cannot sort by ancestor');
|
|
438
436
|
}
|
|
439
437
|
|
|
440
438
|
return this.$_addRule({ name: 'sort', args: { options: settings } });
|
|
@@ -474,7 +472,7 @@ module.exports = Any.extend({
|
|
|
474
472
|
unique: {
|
|
475
473
|
method(comparator, options = {}) {
|
|
476
474
|
|
|
477
|
-
|
|
475
|
+
assert(!comparator || typeof comparator === 'function' || typeof comparator === 'string', 'comparator must be a function or a string');
|
|
478
476
|
Common.assertOptions(options, ['ignoreUndefined', 'separator']);
|
|
479
477
|
|
|
480
478
|
const rule = { name: 'unique', args: { options, comparator } };
|
|
@@ -504,13 +502,13 @@ module.exports = Any.extend({
|
|
|
504
502
|
custom: new Map()
|
|
505
503
|
};
|
|
506
504
|
|
|
507
|
-
const compare = comparator ||
|
|
505
|
+
const compare = comparator || deepEqual;
|
|
508
506
|
const ignoreUndefined = options.ignoreUndefined;
|
|
509
507
|
|
|
510
508
|
for (let i = 0; i < value.length; ++i) {
|
|
511
|
-
const item = path ?
|
|
509
|
+
const item = path ? reach(value[i], path) : value[i];
|
|
512
510
|
const records = comparator ? found.custom : found[typeof item];
|
|
513
|
-
|
|
511
|
+
assert(records, 'Failed to find unique map container for type', typeof item);
|
|
514
512
|
|
|
515
513
|
if (records instanceof Map) {
|
|
516
514
|
const entries = records.entries();
|
|
@@ -565,6 +563,30 @@ module.exports = Any.extend({
|
|
|
565
563
|
}
|
|
566
564
|
},
|
|
567
565
|
|
|
566
|
+
overrides: {
|
|
567
|
+
|
|
568
|
+
isAsync() {
|
|
569
|
+
|
|
570
|
+
if (this.$_terms.externals?.length) {
|
|
571
|
+
return true;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
for (const item of this.$_terms.items) {
|
|
575
|
+
if (item.isAsync()) {
|
|
576
|
+
return true;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
for (const item of this.$_terms.ordered) {
|
|
581
|
+
if (item.isAsync()) {
|
|
582
|
+
return true;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
return false;
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
|
|
568
590
|
cast: {
|
|
569
591
|
set: {
|
|
570
592
|
from: Array.isArray,
|
|
@@ -727,7 +749,7 @@ internals.validateSingle = function (type, obj) {
|
|
|
727
749
|
if (type.type === 'array' ||
|
|
728
750
|
type._flags._arrayItems) {
|
|
729
751
|
|
|
730
|
-
|
|
752
|
+
assert(!obj._flags.single, 'Cannot specify array item with single rule enabled');
|
|
731
753
|
obj.$_setFlag('_arrayItems', true, { clone: false });
|
|
732
754
|
}
|
|
733
755
|
};
|
package/lib/types/binary.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { assert } = require('@hapi/hoek');
|
|
4
4
|
|
|
5
5
|
const Any = require('./any');
|
|
6
6
|
const Common = require('../common');
|
|
@@ -21,7 +21,7 @@ module.exports = Any.extend({
|
|
|
21
21
|
try {
|
|
22
22
|
return { value: Buffer.from(value, schema._flags.encoding) };
|
|
23
23
|
}
|
|
24
|
-
catch
|
|
24
|
+
catch { }
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
},
|
|
@@ -37,7 +37,7 @@ module.exports = Any.extend({
|
|
|
37
37
|
encoding: {
|
|
38
38
|
method(encoding) {
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
assert(Buffer.isEncoding(encoding), 'Invalid encoding:', encoding);
|
|
41
41
|
|
|
42
42
|
return this.$_setFlag('encoding', encoding);
|
|
43
43
|
}
|
package/lib/types/boolean.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { assert } = require('@hapi/hoek');
|
|
4
4
|
|
|
5
5
|
const Any = require('./any');
|
|
6
6
|
const Common = require('../common');
|
|
@@ -76,7 +76,7 @@ module.exports = Any.extend({
|
|
|
76
76
|
for (let i = 0; i < values.length; ++i) {
|
|
77
77
|
const value = values[i];
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
assert(value !== undefined, 'Cannot call truthy with undefined');
|
|
80
80
|
obj.$_terms.truthy.add(value);
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -95,7 +95,7 @@ module.exports = Any.extend({
|
|
|
95
95
|
for (let i = 0; i < values.length; ++i) {
|
|
96
96
|
const value = values[i];
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
assert(value !== undefined, 'Cannot call falsy with undefined');
|
|
99
99
|
obj.$_terms.falsy.add(value);
|
|
100
100
|
}
|
|
101
101
|
|
package/lib/types/date.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { assert } = require('@hapi/hoek');
|
|
4
4
|
|
|
5
5
|
const Any = require('./any');
|
|
6
6
|
const Common = require('../common');
|
|
@@ -78,7 +78,7 @@ module.exports = Any.extend({
|
|
|
78
78
|
format: {
|
|
79
79
|
method(format) {
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
assert(['iso', 'javascript', 'unix'].includes(format), 'Unknown date format', format);
|
|
82
82
|
|
|
83
83
|
return this.$_setFlag('format', format);
|
|
84
84
|
}
|
|
@@ -122,7 +122,7 @@ module.exports = Any.extend({
|
|
|
122
122
|
timestamp: {
|
|
123
123
|
method(type = 'javascript') {
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
assert(['javascript', 'unix'].includes(type), '"type" must be one of "javascript, unix"');
|
|
126
126
|
|
|
127
127
|
return this.format(type);
|
|
128
128
|
}
|
package/lib/types/function.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { assert } = require('@hapi/hoek');
|
|
4
4
|
|
|
5
5
|
const Keys = require('./keys');
|
|
6
6
|
|
|
@@ -20,7 +20,7 @@ module.exports = Keys.extend({
|
|
|
20
20
|
arity: {
|
|
21
21
|
method(n) {
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
assert(Number.isSafeInteger(n) && n >= 0, 'n must be a positive integer');
|
|
24
24
|
|
|
25
25
|
return this.$_addRule({ name: 'arity', args: { n } });
|
|
26
26
|
},
|
|
@@ -52,7 +52,7 @@ module.exports = Keys.extend({
|
|
|
52
52
|
minArity: {
|
|
53
53
|
method(n) {
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
assert(Number.isSafeInteger(n) && n > 0, 'n must be a strict positive integer');
|
|
56
56
|
|
|
57
57
|
return this.$_addRule({ name: 'minArity', args: { n } });
|
|
58
58
|
},
|
|
@@ -69,7 +69,7 @@ module.exports = Keys.extend({
|
|
|
69
69
|
maxArity: {
|
|
70
70
|
method(n) {
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
assert(Number.isSafeInteger(n) && n >= 0, 'n must be a positive integer');
|
|
73
73
|
|
|
74
74
|
return this.$_addRule({ name: 'maxArity', args: { n } });
|
|
75
75
|
},
|
package/lib/types/keys.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const Assert = require('@hapi/hoek/lib/assert');
|
|
5
|
-
const Clone = require('@hapi/hoek/lib/clone');
|
|
3
|
+
const { applyToDefaults, assert, clone: Clone } = require('@hapi/hoek');
|
|
6
4
|
const Topo = require('@hapi/topo');
|
|
7
5
|
|
|
8
6
|
const Any = require('./any');
|
|
@@ -199,7 +197,7 @@ module.exports = Any.extend({
|
|
|
199
197
|
subject = Compile.ref(subject);
|
|
200
198
|
}
|
|
201
199
|
|
|
202
|
-
|
|
200
|
+
assert(message === undefined || typeof message === 'string', 'Message must be a string');
|
|
203
201
|
|
|
204
202
|
schema = this.$_compile(schema, { appendPath: true });
|
|
205
203
|
|
|
@@ -225,7 +223,7 @@ module.exports = Any.extend({
|
|
|
225
223
|
instance: {
|
|
226
224
|
method(constructor, name) {
|
|
227
225
|
|
|
228
|
-
|
|
226
|
+
assert(typeof constructor === 'function', 'constructor must be a function');
|
|
229
227
|
|
|
230
228
|
name = name || constructor.name;
|
|
231
229
|
|
|
@@ -245,8 +243,8 @@ module.exports = Any.extend({
|
|
|
245
243
|
keys: {
|
|
246
244
|
method(schema) {
|
|
247
245
|
|
|
248
|
-
|
|
249
|
-
|
|
246
|
+
assert(schema === undefined || typeof schema === 'object', 'Object schema must be a valid object');
|
|
247
|
+
assert(!Common.isSchema(schema), 'Object schema cannot be a joi schema');
|
|
250
248
|
|
|
251
249
|
const obj = this.clone();
|
|
252
250
|
|
|
@@ -337,11 +335,11 @@ module.exports = Any.extend({
|
|
|
337
335
|
pattern = this.$_compile(pattern, { appendPath: true });
|
|
338
336
|
}
|
|
339
337
|
|
|
340
|
-
|
|
338
|
+
assert(schema !== undefined, 'Invalid rule');
|
|
341
339
|
Common.assertOptions(options, ['fallthrough', 'matches']);
|
|
342
340
|
|
|
343
341
|
if (isRegExp) {
|
|
344
|
-
|
|
342
|
+
assert(!pattern.flags.includes('g') && !pattern.flags.includes('y'), 'pattern should not use global or sticky mode');
|
|
345
343
|
}
|
|
346
344
|
|
|
347
345
|
schema = this.$_compile(schema, { appendPath: true });
|
|
@@ -402,9 +400,9 @@ module.exports = Any.extend({
|
|
|
402
400
|
rename: {
|
|
403
401
|
method(from, to, options = {}) {
|
|
404
402
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
403
|
+
assert(typeof from === 'string' || from instanceof RegExp, 'Rename missing the from argument');
|
|
404
|
+
assert(typeof to === 'string' || to instanceof Template, 'Invalid rename to argument');
|
|
405
|
+
assert(to !== from, 'Cannot rename key to same name:', from);
|
|
408
406
|
|
|
409
407
|
Common.assertOptions(options, ['alias', 'ignoreUndefined', 'override', 'multiple']);
|
|
410
408
|
|
|
@@ -412,7 +410,7 @@ module.exports = Any.extend({
|
|
|
412
410
|
|
|
413
411
|
obj.$_terms.renames = obj.$_terms.renames || [];
|
|
414
412
|
for (const rename of obj.$_terms.renames) {
|
|
415
|
-
|
|
413
|
+
assert(rename.from !== from, 'Cannot rename the same key multiple times');
|
|
416
414
|
}
|
|
417
415
|
|
|
418
416
|
if (to instanceof Template) {
|
|
@@ -422,7 +420,7 @@ module.exports = Any.extend({
|
|
|
422
420
|
obj.$_terms.renames.push({
|
|
423
421
|
from,
|
|
424
422
|
to,
|
|
425
|
-
options:
|
|
423
|
+
options: applyToDefaults(internals.renameDefaults, options)
|
|
426
424
|
});
|
|
427
425
|
|
|
428
426
|
return obj;
|
|
@@ -486,6 +484,31 @@ module.exports = Any.extend({
|
|
|
486
484
|
}
|
|
487
485
|
|
|
488
486
|
return this.$_parent('default', value, options);
|
|
487
|
+
},
|
|
488
|
+
|
|
489
|
+
isAsync() {
|
|
490
|
+
|
|
491
|
+
if (this.$_terms.externals?.length) {
|
|
492
|
+
return true;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
if (this.$_terms.keys?.length) {
|
|
496
|
+
for (const key of this.$_terms.keys) {
|
|
497
|
+
if (key.schema.isAsync()) {
|
|
498
|
+
return true;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
if (this.$_terms.patterns?.length) {
|
|
504
|
+
for (const pattern of this.$_terms.patterns) {
|
|
505
|
+
if (pattern.rule.isAsync()) {
|
|
506
|
+
return true;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
return false;
|
|
489
512
|
}
|
|
490
513
|
},
|
|
491
514
|
|
|
@@ -589,7 +612,7 @@ internals.clone = function (value, prefs) {
|
|
|
589
612
|
|
|
590
613
|
internals.dependency = function (schema, rel, key, peers, options) {
|
|
591
614
|
|
|
592
|
-
|
|
615
|
+
assert(key === null || typeof key === 'string', rel, 'key must be a strings');
|
|
593
616
|
|
|
594
617
|
// Extract options from peers array
|
|
595
618
|
|
|
@@ -606,7 +629,7 @@ internals.dependency = function (schema, rel, key, peers, options) {
|
|
|
606
629
|
const separator = Common.default(options.separator, '.');
|
|
607
630
|
const paths = [];
|
|
608
631
|
for (const peer of peers) {
|
|
609
|
-
|
|
632
|
+
assert(typeof peer === 'string', rel, 'peers must be strings');
|
|
610
633
|
paths.push(Compile.ref(peer, { separator, ancestor: 0, prefix: false }));
|
|
611
634
|
}
|
|
612
635
|
|
package/lib/types/link.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { assert } = require('@hapi/hoek');
|
|
4
4
|
|
|
5
5
|
const Any = require('./any');
|
|
6
6
|
const Common = require('../common');
|
|
@@ -31,7 +31,7 @@ module.exports = Any.extend({
|
|
|
31
31
|
|
|
32
32
|
validate(value, { schema, state, prefs }) {
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
assert(schema.$_terms.link, 'Uninitialized link schema');
|
|
35
35
|
|
|
36
36
|
const linked = internals.generate(schema, value, state, prefs);
|
|
37
37
|
const ref = schema.$_terms.link[0].ref;
|
|
@@ -48,12 +48,12 @@ module.exports = Any.extend({
|
|
|
48
48
|
ref: {
|
|
49
49
|
method(ref) {
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
assert(!this.$_terms.link, 'Cannot reinitialize schema');
|
|
52
52
|
|
|
53
53
|
ref = Compile.ref(ref);
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
assert(ref.type === 'value' || ref.type === 'local', 'Invalid reference type:', ref.type);
|
|
56
|
+
assert(ref.type === 'local' || ref.ancestor === 'root' || ref.ancestor > 0, 'Link cannot reference itself');
|
|
57
57
|
|
|
58
58
|
const obj = this.clone();
|
|
59
59
|
obj.$_terms.link = [{ ref }];
|
|
@@ -73,9 +73,9 @@ module.exports = Any.extend({
|
|
|
73
73
|
|
|
74
74
|
concat(source) {
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
assert(this.$_terms.link, 'Uninitialized link schema');
|
|
77
|
+
assert(Common.isSchema(source), 'Invalid schema object');
|
|
78
|
+
assert(source.type !== 'link', 'Cannot merge type link with another link');
|
|
79
79
|
|
|
80
80
|
const obj = this.clone();
|
|
81
81
|
|
|
@@ -92,7 +92,7 @@ module.exports = Any.extend({
|
|
|
92
92
|
|
|
93
93
|
build(obj, desc) {
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
assert(desc.link, 'Invalid link description missing link');
|
|
96
96
|
return obj.ref(desc.link);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -115,7 +115,7 @@ internals.generate = function (schema, value, state, prefs) {
|
|
|
115
115
|
try {
|
|
116
116
|
linked = path.length ? perspective.$_reach(path) : perspective;
|
|
117
117
|
}
|
|
118
|
-
catch
|
|
118
|
+
catch {
|
|
119
119
|
internals.assert(false, 'to non-existing schema', ref, schema, state, prefs);
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -164,5 +164,5 @@ internals.assert = function (condition, message, ref, schema, state, prefs) {
|
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
assert(false, `"${Errors.label(schema._flags, state, prefs)}" contains link reference "${ref.display}" ${message}`);
|
|
168
168
|
};
|
package/lib/types/number.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { assert } = require('@hapi/hoek');
|
|
4
4
|
|
|
5
5
|
const Any = require('./any');
|
|
6
6
|
const Common = require('../common');
|
|
@@ -251,7 +251,7 @@ module.exports = Any.extend({
|
|
|
251
251
|
precision: {
|
|
252
252
|
method(limit) {
|
|
253
253
|
|
|
254
|
-
|
|
254
|
+
assert(Number.isSafeInteger(limit), 'limit must be an integer');
|
|
255
255
|
|
|
256
256
|
return this.$_addRule({ name: 'precision', args: { limit } });
|
|
257
257
|
},
|
|
@@ -271,7 +271,7 @@ module.exports = Any.extend({
|
|
|
271
271
|
sign: {
|
|
272
272
|
method(sign) {
|
|
273
273
|
|
|
274
|
-
|
|
274
|
+
assert(['negative', 'positive'].includes(sign), 'Invalid sign', sign);
|
|
275
275
|
|
|
276
276
|
return this.$_addRule({ name: 'sign', args: { sign } });
|
|
277
277
|
},
|
|
@@ -290,7 +290,7 @@ module.exports = Any.extend({
|
|
|
290
290
|
unsafe: {
|
|
291
291
|
method(enabled = true) {
|
|
292
292
|
|
|
293
|
-
|
|
293
|
+
assert(typeof enabled === 'boolean', 'enabled must be a boolean');
|
|
294
294
|
|
|
295
295
|
return this.$_setFlag('unsafe', enabled);
|
|
296
296
|
}
|