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

ajv-error-tree

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ajv-error-tree - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

32

lib/main.js

@@ -1,3 +0,10 @@

const { strict: Assert } = require("assert");
const { ownKeys, getOwnPropertyDescriptor } = Reflect;
const { isArray } = Array;
const assert = (boolean, message) => {
if (!boolean) {
throw new Error(message);
}
};
exports.structureAJVErrorArray = (errors) => {

@@ -7,3 +14,3 @@ let index = errors.length;

index -= 1;
Assert.ok(index >= 0, "something went wrong");
assert(index >= 0, "something went wrong");
const error = {

@@ -14,12 +21,7 @@ ...errors[index],

};
Assert.notEqual(
Reflect.getOwnPropertyDescriptor(error, "schema"),
undefined,
assert(
getOwnPropertyDescriptor(error, "schema") !== undefined,
"missing schema field, this is probably because the verbose options was not set to true -- new Ajv({verbose:true})"
);
Assert.notEqual(
error.keyword,
"allOf",
"unexpected allOf schema combinator"
);
assert(error.keyword !== "allOf", "unexpected allOf schema combinator");
if (error.keyword === "anyOf") {

@@ -45,9 +47,9 @@ error.children = error.schema.slice().reverse().map(visit).reverse();

if (depth === 0) {
return Array.isArray(any) ? "... (array)" : "... (object)";
return isArray(any) ? "... (array)" : "... (object)";
}
if (Array.isArray(any)) {
if (isArray(any)) {
return any.map((any) => strip(any, depth - 1));
}
let copy = { __proto__: null };
for (let key of Reflect.ownKeys(any)) {
for (let key of ownKeys(any)) {
copy[key] = strip(any[key], depth - 1);

@@ -90,5 +92,3 @@ }

},
...(Reflect.ownKeys(error.params).length === 0
? {}
: { params: error.params }),
...(ownKeys(error.params).length === 0 ? {} : { params: error.params }),
message: error.message,

@@ -95,0 +95,0 @@ ...(error.children.length === 0

{
"name": "ajv-error-tree",
"version": "0.0.4",
"version": "0.0.5",
"scripts": {
"test": "node test/test.js",
"prettier": "npx prettier --write 'lib/*.js' 'test/*.js'",
"format": "npx prettier --write 'lib/*.js' 'test/*.js'",
"lint": "npx eslint 'lib/*.js' 'test/*.js'"

@@ -8,0 +8,0 @@ },

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