New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

enjoi

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enjoi - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

69

lib/enjoi.js

@@ -17,2 +17,11 @@ 'use strict';

if (current.anyOf) {
return resolveAnyOf(current);
}
if (current.allOf) {
return resolveAllOf(current);
}
if (current.$ref) {

@@ -83,2 +92,18 @@ return resolve(refresolver(current.$ref));

function resolveAnyOf(current) {
Assert.ok(Thing.isArray(current.anyOf), 'Expected anyOf to be an array.');
return Joi.alternatives().try(current.anyOf.map(function (schema) {
return resolve(schema);
}));
}
function resolveAllOf(current) {
Assert.ok(Thing.isArray(current.allOf), 'Expected allOf to be an array.');
return new All().try(current.allOf.map(function (schema) {
return resolve(schema);
}));
}
function resolveproperties(current) {

@@ -163,1 +188,45 @@ var schemas = {};

};
function All() {
All.super_.call(this);
this._type = 'all';
this._invalids.remove(null);
this._inner.matches = [];
}
require('util').inherits(All, Object.getPrototypeOf(require('joi/lib/alternatives')).constructor);
All.prototype._base = function (value, state, options) {
var errors = [];
var results = [];
if (!options) {
options = {};
}
options.stripUnknown = true;
for (var i = 0, il = this._inner.matches.length; i < il; ++i) {
var item = this._inner.matches[i];
var schema = item.schema;
if (!schema) {
var failed = item.is._validate(item.ref(state.parent, options), null, options, state.parent).errors;
schema = failed ? item.otherwise : item.then;
if (!schema) {
continue;
}
}
var result = schema._validate(value, state, options);
if (!result.errors) {
results.push(result.value);
}
else {
errors = errors.concat(result.errors);
}
}
return { value: value, errors: errors };
};

2

package.json
{
"name": "enjoi",
"version": "0.2.2",
"version": "0.2.3",
"description": "Converts json-schema to Joi schema for validation.",

@@ -5,0 +5,0 @@ "main": "lib/enjoi.js",

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