joi 8.4.2 → 9.0.0-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/lib/lazy.js DELETED
@@ -1,51 +0,0 @@
1
- 'use strict';
2
-
3
- // Load modules
4
-
5
- const Any = require('./any');
6
- const Hoek = require('hoek');
7
-
8
-
9
- // Declare internals
10
-
11
- const internals = {};
12
-
13
-
14
- internals.Lazy = function () {
15
-
16
- Any.call(this);
17
- this._type = 'lazy';
18
- };
19
-
20
- Hoek.inherits(internals.Lazy, Any);
21
-
22
- internals.Lazy.prototype._base = function (value, state, options) {
23
-
24
- const result = { value };
25
- const lazy = this._flags.lazy;
26
-
27
- if (!lazy) {
28
- result.errors = this.createError('lazy.base', null, state, options);
29
- return result;
30
- }
31
-
32
- const schema = lazy();
33
-
34
- if (!(schema instanceof Any)) {
35
- result.errors = this.createError('lazy.schema', null, state, options);
36
- return result;
37
- }
38
-
39
- return schema._validate(value, state, options);
40
- };
41
-
42
- internals.Lazy.prototype.set = function (fn) {
43
-
44
- Hoek.assert(typeof fn === 'function', 'You must provide a function as first argument');
45
-
46
- const obj = this.clone();
47
- obj._flags.lazy = fn;
48
- return obj;
49
- };
50
-
51
- module.exports = new internals.Lazy();
package/lib/schemas.js DELETED
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- // Load modules
4
-
5
- const Joi = require('../');
6
-
7
-
8
- // Declare internals
9
-
10
- const internals = {};
11
-
12
- exports.options = Joi.object({
13
- abortEarly: Joi.boolean(),
14
- convert: Joi.boolean(),
15
- allowUnknown: Joi.boolean(),
16
- skipFunctions: Joi.boolean(),
17
- stripUnknown: [Joi.boolean(), Joi.object({ arrays: Joi.boolean(), objects: Joi.boolean() }).or('arrays', 'objects')],
18
- language: Joi.object(),
19
- presence: Joi.string().only('required', 'optional', 'forbidden', 'ignore'),
20
- raw: Joi.boolean(),
21
- context: Joi.object(),
22
- strip: Joi.boolean(),
23
- noDefaults: Joi.boolean(),
24
- error: Joi.object()
25
- }).strict();