@hapi/validate
Advanced tools
Comparing version 1.1.3 to 2.0.0
@@ -194,4 +194,4 @@ 'use strict'; | ||
for (const item of conditions) { | ||
Assert(!item.then || item.then.type === 'any' || item.then.type === obj.type, 'Cannot combine', obj.type, 'with', item.then && item.then.type); | ||
Assert(!item.otherwise || item.otherwise.type === 'any' || item.otherwise.type === obj.type, 'Cannot combine', obj.type, 'with', item.otherwise && item.otherwise.type); | ||
Assert(!item.then || item.then.type === 'any' || item.then.type === obj.type, 'Cannot combine', obj.type, 'with', item.then?.type); | ||
Assert(!item.otherwise || item.otherwise.type === 'any' || item.otherwise.type === obj.type, 'Cannot combine', obj.type, 'with', item.otherwise?.type); | ||
@@ -447,3 +447,3 @@ } | ||
const family = this._definition[source][name] && this._definition[source][name].register; | ||
const family = this._definition[source][name]?.register; | ||
if (family !== false) { | ||
@@ -531,4 +531,4 @@ this.$_mutateRegister(item, { family, key }); | ||
target._preferences = this._preferences; | ||
target._valids = this._valids && this._valids.clone(); | ||
target._invalids = this._invalids && this._invalids.clone(); | ||
target._valids = this._valids?.clone(); | ||
target._invalids = this._invalids?.clone(); | ||
target._rules = this._rules.slice(); | ||
@@ -535,0 +535,0 @@ target._singleRules = Clone(this._singleRules, { shallow: true }); |
@@ -119,3 +119,3 @@ 'use strict'; | ||
const string = internals.stringify(rendered, prefs, options.errors); | ||
const result = part.raw || (options.errors && options.errors.escapeHtml) === false ? string : EscapeHtml(string); | ||
const result = (part.raw || options.errors?.escapeHtml === false) ? string : EscapeHtml(string); | ||
parts.push(internals.wrap(result, part.wrapped && prefs.errors.wrap.label)); | ||
@@ -122,0 +122,0 @@ } |
@@ -51,4 +51,4 @@ 'use strict'; | ||
if (typeof value !== 'boolean') { | ||
value = schema.$_terms.truthy && schema.$_terms.truthy.has(value, null, null, !schema._flags.sensitive) || | ||
(schema.$_terms.falsy && schema.$_terms.falsy.has(value, null, null, !schema._flags.sensitive) ? false : value); | ||
value = schema.$_terms.truthy?.has(value, null, null, !schema._flags.sensitive) || | ||
(schema.$_terms.falsy?.has(value, null, null, !schema._flags.sensitive) ? false : value); | ||
} | ||
@@ -55,0 +55,0 @@ |
@@ -148,3 +148,3 @@ 'use strict'; | ||
return { perspective: state.schemas[ref.ancestor] && state.schemas[ref.ancestor].schema, path: ref.path }; | ||
return { perspective: state.schemas[ref.ancestor]?.schema, path: ref.path }; | ||
}; | ||
@@ -151,0 +151,0 @@ |
@@ -395,3 +395,3 @@ 'use strict'; | ||
const length = encoding ? Buffer && Buffer.byteLength(value, encoding) : value.length; // $lab:coverage:ignore$ | ||
const length = encoding ? Buffer.byteLength(value, encoding) : value.length; | ||
if (Common.compare(length, limit, operator)) { | ||
@@ -606,3 +606,3 @@ return value; | ||
Assert(!encoding || Buffer && Buffer.isEncoding(encoding), 'Invalid encoding:', encoding); // $lab:coverage:ignore$ | ||
Assert(!encoding || Buffer.isEncoding(encoding), 'Invalid encoding:', encoding); | ||
@@ -609,0 +609,0 @@ return schema.$_addRule({ name, method: 'length', args: { limit, encoding }, operator }); |
@@ -1,2 +0,3 @@ | ||
Copyright (c) 2012-2020, Sideway Inc, and project contributors | ||
Copyright (c) 2012-2022, Project contributors | ||
Copyright (c) 2012-2020, Sideway Inc | ||
Copyright (c) 2012-2014, Walmart. | ||
@@ -3,0 +4,0 @@ All rights reserved. |
{ | ||
"name": "@hapi/validate", | ||
"description": "Object schema validation", | ||
"version": "1.1.3", | ||
"version": "2.0.0", | ||
"repository": "git://github.com/hapijs/validate", | ||
@@ -10,10 +10,16 @@ "main": "lib/index.js", | ||
], | ||
"eslintConfig": { | ||
"extends": [ | ||
"plugin:@hapi/module" | ||
] | ||
}, | ||
"dependencies": { | ||
"@hapi/hoek": "^9.0.0", | ||
"@hapi/topo": "^5.0.0" | ||
"@hapi/hoek": "^10.0.0", | ||
"@hapi/topo": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"@hapi/bourne": "2.x.x", | ||
"@hapi/code": "8.x.x", | ||
"@hapi/lab": "24.x.x" | ||
"@hapi/bourne": "^3.0.0", | ||
"@hapi/code": "^9.0.0", | ||
"@hapi/eslint-plugin": "*", | ||
"@hapi/lab": "25.0.0-beta.1" | ||
}, | ||
@@ -20,0 +26,0 @@ "scripts": { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
213090
4
+ Added@hapi/hoek@10.0.111.0.7(transitive)
+ Added@hapi/topo@6.0.2(transitive)
- Removed@hapi/hoek@9.3.0(transitive)
- Removed@hapi/topo@5.1.0(transitive)
Updated@hapi/hoek@^10.0.0
Updated@hapi/topo@^6.0.0