Comparing version 11.3.0 to 11.3.2
@@ -50,3 +50,3 @@ 'use strict'; | ||
return internals.applyDefaults.call(this, any); | ||
return internals.applyDefaults.call(this || root, any); | ||
}; | ||
@@ -56,3 +56,3 @@ | ||
const alternatives = internals.applyDefaults.call(this, internals.alternatives); | ||
const alternatives = internals.applyDefaults.call(this || root, internals.alternatives); | ||
return arguments.length ? alternatives.try.apply(alternatives, arguments) : alternatives; | ||
@@ -65,3 +65,3 @@ }; | ||
return internals.applyDefaults.call(this, internals.array); | ||
return internals.applyDefaults.call(this || root, internals.array); | ||
}; | ||
@@ -73,3 +73,3 @@ | ||
return internals.applyDefaults.call(this, internals.boolean); | ||
return internals.applyDefaults.call(this || root, internals.boolean); | ||
}; | ||
@@ -81,3 +81,3 @@ | ||
return internals.applyDefaults.call(this, internals.binary); | ||
return internals.applyDefaults.call(this || root, internals.binary); | ||
}; | ||
@@ -89,3 +89,3 @@ | ||
return internals.applyDefaults.call(this, internals.date); | ||
return internals.applyDefaults.call(this || root, internals.date); | ||
}; | ||
@@ -97,3 +97,3 @@ | ||
return internals.applyDefaults.call(this, internals.func); | ||
return internals.applyDefaults.call(this || root, internals.func); | ||
}; | ||
@@ -105,3 +105,3 @@ | ||
return internals.applyDefaults.call(this, internals.number); | ||
return internals.applyDefaults.call(this || root, internals.number); | ||
}; | ||
@@ -111,3 +111,3 @@ | ||
const object = internals.applyDefaults.call(this, internals.object); | ||
const object = internals.applyDefaults.call(this || root, internals.object); | ||
return arguments.length ? object.keys.apply(object, arguments) : object; | ||
@@ -120,3 +120,3 @@ }; | ||
return internals.applyDefaults.call(this, internals.string); | ||
return internals.applyDefaults.call(this || root, internals.string); | ||
}; | ||
@@ -259,6 +259,7 @@ | ||
this.assert(extensions, root.extensionsSchema); | ||
const currentJoi = this || root; | ||
currentJoi.assert(extensions, root.extensionsSchema); | ||
const joi = Object.create(this.any()); | ||
Object.assign(joi, this); | ||
const joi = Object.create(currentJoi.any()); | ||
Object.assign(joi, currentJoi); | ||
@@ -272,5 +273,5 @@ for (let i = 0; i < extensions.length; ++i) { | ||
this.assert(extension, root.extensionSchema); | ||
currentJoi.assert(extension, root.extensionSchema); | ||
const base = (extension.base || this.any()).clone(); // Cloning because we're going to override language afterwards | ||
const base = (extension.base || currentJoi.any()).clone(); // Cloning because we're going to override language afterwards | ||
const ctor = base.constructor; | ||
@@ -347,3 +348,3 @@ const type = class extends ctor { // eslint-disable-line no-loop-func | ||
[]; | ||
const validateArgs = rule.params ? Cast.schema(this, rule.params) : null; | ||
const validateArgs = rule.params ? Cast.schema(currentJoi, rule.params) : null; | ||
@@ -411,3 +412,3 @@ type.prototype[rule.name] = function () { // eslint-disable-line no-loop-func | ||
return internals.applyDefaults.call(this, instance); | ||
return internals.applyDefaults.call(this || joi, instance); | ||
}; | ||
@@ -414,0 +415,0 @@ } |
@@ -100,3 +100,7 @@ 'use strict'; | ||
multiple: 'cannot rename child "{{from}}" because multiple renames are disabled and another key was already renamed to "{{to}}"', | ||
override: 'cannot rename child "{{from}}" because override is disabled and target "{{to}}" exists' | ||
override: 'cannot rename child "{{from}}" because override is disabled and target "{{to}}" exists', | ||
regex: { | ||
multiple: 'cannot rename children {{from}} because multiple renames are disabled and another key was already renamed to "{{to}}"', | ||
override: 'cannot rename children {{from}} because override is disabled and target "{{to}}" exists' | ||
} | ||
}, | ||
@@ -103,0 +107,0 @@ type: 'must be an instance of "{{type}}"', |
@@ -115,3 +115,3 @@ 'use strict'; | ||
errors.push(this.createError('object.rename.multiple', { from: matchedTargetKeys, to: rename.to }, state, options)); | ||
errors.push(this.createError('object.rename.regex.multiple', { from: matchedTargetKeys, to: rename.to }, state, options)); | ||
if (options.abortEarly) { | ||
@@ -126,3 +126,3 @@ return finish(); | ||
errors.push(this.createError('object.rename.override', { from: rename.from, to: rename.to }, state, options)); | ||
errors.push(this.createError('object.rename.regex.override', { from: matchedTargetKeys, to: rename.to }, state, options)); | ||
if (options.abortEarly) { | ||
@@ -129,0 +129,0 @@ return finish(); |
{ | ||
"name": "joi", | ||
"description": "Object schema validation", | ||
"version": "11.3.0", | ||
"version": "11.3.2", | ||
"homepage": "https://github.com/hapijs/joi", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/hapijs/joi", |
@@ -29,3 +29,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/v11.3.0/API.md). | ||
See the detailed [API Reference](https://github.com/hapijs/joi/blob/v11.3.2/API.md). | ||
@@ -32,0 +32,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
172812
4061