Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

joi

Package Overview
Dependencies
Maintainers
6
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joi - npm Package Compare versions

Comparing version 17.6.4 to 17.7.0

46

lib/types/keys.js

@@ -147,4 +147,6 @@ 'use strict';

for (const dep of schema.$_terms.dependencies) {
if (dep.key &&
dep.key.resolve(value, state, prefs, null, { shadow: false }) === undefined) {
if (
dep.key !== null &&
internals.isPresent(dep.options)(dep.key.resolve(value, state, prefs, null, { shadow: false })) === false
) {

@@ -599,3 +601,3 @@ continue;

Common.assertOptions(options, ['separator']);
Common.assertOptions(options, ['separator', 'isPresent']);

@@ -623,3 +625,3 @@ peers = [].concat(peers);

obj.$_terms.dependencies = obj.$_terms.dependencies || [];
obj.$_terms.dependencies.push(new internals.Dependency(rel, key, paths, peers));
obj.$_terms.dependencies.push(new internals.Dependency(rel, key, paths, peers, options));
return obj;

@@ -636,4 +638,5 @@ };

const count = dep.peers.length;
const isPresent = internals.isPresent(dep.options);
for (const peer of dep.peers) {
if (peer.resolve(value, state, prefs, null, { shadow: false }) === undefined) {
if (isPresent(peer.resolve(value, state, prefs, null, { shadow: false })) === false) {
missing.push(peer.key);

@@ -664,4 +667,5 @@ }

const present = [];
const isPresent = internals.isPresent(dep.options);
for (const peer of dep.peers) {
if (peer.resolve(value, state, prefs, null, { shadow: false }) !== undefined) {
if (isPresent(peer.resolve(value, state, prefs, null, { shadow: false }))) {
present.push(peer.key);

@@ -690,4 +694,5 @@ }

const isPresent = internals.isPresent(dep.options);
for (const peer of dep.peers) {
if (peer.resolve(value, state, prefs, null, { shadow: false }) !== undefined) {
if (isPresent(peer.resolve(value, state, prefs, null, { shadow: false }))) {
return;

@@ -709,4 +714,5 @@ }

const present = [];
const isPresent = internals.isPresent(dep.options);
for (const peer of dep.peers) {
if (peer.resolve(value, state, prefs, null, { shadow: false }) !== undefined) {
if (isPresent(peer.resolve(value, state, prefs, null, { shadow: false }))) {
present.push(peer.key);

@@ -730,4 +736,5 @@ }

const isPresent = internals.isPresent(dep.options);
for (const peer of dep.peers) {
if (peer.resolve(value, state, prefs, null, { shadow: false }) === undefined) {
if (isPresent(peer.resolve(value, state, prefs, null, { shadow: false })) === false) {
return {

@@ -748,4 +755,5 @@ code: 'object.with',

const isPresent = internals.isPresent(dep.options);
for (const peer of dep.peers) {
if (peer.resolve(value, state, prefs, null, { shadow: false }) !== undefined) {
if (isPresent(peer.resolve(value, state, prefs, null, { shadow: false }))) {
return {

@@ -767,4 +775,5 @@ code: 'object.without',

const present = [];
const isPresent = internals.isPresent(dep.options);
for (const peer of dep.peers) {
if (peer.resolve(value, state, prefs, null, { shadow: false }) !== undefined) {
if (isPresent(peer.resolve(value, state, prefs, null, { shadow: false }))) {
present.push(peer.key);

@@ -800,2 +809,8 @@ }

internals.isPresent = function (options) {
return typeof options.isPresent === 'function' ? options.isPresent : (resolved) => resolved !== undefined;
};
internals.rename = function (schema, value, state, prefs, errors) {

@@ -1006,3 +1021,3 @@

constructor(rel, key, peers, paths) {
constructor(rel, key, peers, paths, options) {

@@ -1013,2 +1028,3 @@ this.rel = rel;

this.paths = paths;
this.options = options;
}

@@ -1028,5 +1044,9 @@

if (this.peers[0].separator !== '.') {
desc.options = { separator: this.peers[0].separator };
desc.options = { ...desc.options, separator: this.peers[0].separator };
}
if (this.options.isPresent) {
desc.options = { ...desc.options, isPresent: this.options.isPresent };
}
return desc;

@@ -1033,0 +1053,0 @@ }

@@ -11,3 +11,7 @@ 'use strict';

numberRx: /^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,
precisionRx: /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/
precisionRx: /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,
exponentialPartRegex: /[eE][+-]?\d+$/,
leadingSignAndZerosRegex: /^[+-]?(0*)?/,
dotRegex: /\./,
trailingZerosRegex: /0+$/
};

@@ -43,4 +47,3 @@

if (value.match(/e/i)) {
const constructed = internals.normalizeExponent(`${result.value / Math.pow(10, matches[1])}e${matches[1]}`);
if (constructed !== internals.normalizeExponent(value)) {
if (internals.extractSignificantDigits(value) !== internals.extractSignificantDigits(String(result.value))) {
result.errors = error('number.unsafe');

@@ -302,11 +305,9 @@ return result;

internals.normalizeExponent = function (str) {
internals.extractSignificantDigits = function (value) {
return str
.replace(/E/, 'e')
.replace(/\.(\d*[1-9])?0+e/, '.$1e')
.replace(/\.e/, 'e')
.replace(/e\+/, 'e')
.replace(/^\+/, '')
.replace(/^(-?)0+([1-9])/, '$1$2');
return value
.replace(internals.exponentialPartRegex, '')
.replace(internals.dotRegex, '')
.replace(internals.trailingZerosRegex, '')
.replace(internals.leadingSignAndZerosRegex, '');
};

@@ -313,0 +314,0 @@

{
"name": "joi",
"description": "Object schema validation",
"version": "17.6.4",
"version": "17.7.0",
"repository": "git://github.com/hapijs/joi",

@@ -6,0 +6,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc