Comparing version 14.2.0 to 14.3.0
@@ -49,2 +49,3 @@ 'use strict'; | ||
root._currentJoi = root; | ||
root._binds = new Set(['any', 'alternatives', 'alt', 'array', 'boolean', 'binary', 'date', 'func', 'number', 'object', 'string', 'symbol', 'validate', 'describe', 'compile', 'assert', 'attempt', 'lazy', 'defaults', 'extend']); | ||
@@ -145,3 +146,3 @@ root.any = function (...args) { | ||
const options = count === 2 ? args[1] : undefined; | ||
const schema = root.compile(args[0]); | ||
const schema = this.compile(args[0]); | ||
@@ -153,3 +154,3 @@ return schema._validateWithOptions(value, options, callback); | ||
const schema = args.length ? root.compile(args[0]) : any; | ||
const schema = args.length ? this.compile(args[0]) : any; | ||
return schema.describe(); | ||
@@ -174,3 +175,3 @@ }; | ||
root.attempt(value, schema, message); | ||
this.attempt(value, schema, message); | ||
}; | ||
@@ -180,3 +181,3 @@ | ||
const result = root.validate(value, schema); | ||
const result = this.validate(value, schema); | ||
const error = result.error; | ||
@@ -267,2 +268,14 @@ if (error) { | ||
root.bind = function () { | ||
const joi = Object.create(this); | ||
joi._binds.forEach((bind) => { | ||
joi[bind] = joi[bind].bind(joi); | ||
}); | ||
return joi; | ||
}; | ||
root.extend = function (...args) { | ||
@@ -277,2 +290,4 @@ | ||
Object.assign(joi, this); | ||
joi._currentJoi = joi; | ||
joi._binds = new Set(joi._binds); | ||
@@ -426,2 +441,4 @@ for (let i = 0; i < extensions.length; ++i) { | ||
}; | ||
joi._binds.add(extension.name); | ||
} | ||
@@ -428,0 +445,0 @@ |
@@ -311,3 +311,3 @@ 'use strict'; | ||
const localState = hasKey ? new State(splitKey[splitKey.length - 1], [...state.path, ...splitKey]) : new State(null, state.path); | ||
const err = internals[dep.type].call(this, dep.key, hasKey && Hoek.reach(target, dep.key), dep.peers, target, localState, options); | ||
const err = internals[dep.type].call(this, dep.key, hasKey && Hoek.reach(target, dep.key, { functions: true }), dep.peers, target, localState, options); | ||
if (err instanceof Errors.Err) { | ||
@@ -797,3 +797,3 @@ errors.push(err); | ||
const peer = peers[i]; | ||
const keysExist = Hoek.reach(parent, peer); | ||
const keysExist = Hoek.reach(parent, peer, { functions: true }); | ||
if (keysExist === undefined) { | ||
@@ -820,3 +820,3 @@ | ||
const peer = peers[i]; | ||
const keysExist = Hoek.reach(parent, peer); | ||
const keysExist = Hoek.reach(parent, peer, { functions: true }); | ||
if (keysExist !== undefined) { | ||
@@ -840,3 +840,3 @@ | ||
const peer = peers[i]; | ||
const keysExist = Hoek.reach(parent, peer); | ||
const keysExist = Hoek.reach(parent, peer, { functions: true }); | ||
if (keysExist !== undefined) { | ||
@@ -869,3 +869,3 @@ present.push(peer); | ||
const peer = peers[i]; | ||
const keysExist = Hoek.reach(parent, peer); | ||
const keysExist = Hoek.reach(parent, peer, { functions: true }); | ||
if (keysExist !== undefined) { | ||
@@ -894,3 +894,3 @@ present.push(peer); | ||
const peer = peers[i]; | ||
const keysExist = Hoek.reach(parent, peer); | ||
const keysExist = Hoek.reach(parent, peer, { functions: true }); | ||
if (keysExist !== undefined) { | ||
@@ -915,3 +915,3 @@ return; | ||
const peer = peers[i]; | ||
const keysExist = Hoek.reach(parent, peer); | ||
const keysExist = Hoek.reach(parent, peer, { functions: true }); | ||
if (keysExist === undefined) { | ||
@@ -945,3 +945,3 @@ | ||
const peer = peers[i]; | ||
const keysExist = Hoek.reach(parent, peer); | ||
const keysExist = Hoek.reach(parent, peer, { functions: true }); | ||
if (keysExist !== undefined) { | ||
@@ -948,0 +948,0 @@ |
{ | ||
"name": "joi", | ||
"description": "Object schema validation", | ||
"version": "14.2.0", | ||
"version": "14.3.0", | ||
"homepage": "https://github.com/hapijs/joi", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/hapijs/joi", |
@@ -19,3 +19,3 @@ ![joi Logo](https://raw.github.com/hapijs/joi/master/images/joi.png) | ||
# API | ||
See the detailed [API Reference](https://github.com/hapijs/joi/blob/v14.2.0/API.md). | ||
See the detailed [API Reference](https://github.com/hapijs/joi/blob/v14.3.0/API.md). | ||
@@ -22,0 +22,0 @@ # Example |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
192729
4571