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

indicative-compiler

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

indicative-compiler - npm Package Compare versions

Comparing version 7.0.1 to 7.0.2

4

build/src/contracts.d.ts

@@ -24,5 +24,5 @@ import { ParsedRule, Message } from 'indicative-parser';

};
export interface ErrorFormatterContract<T extends any = any> {
export interface ErrorFormatterContract {
addError(error: string | Error, field: string, ruleName: ParsedRule['name'], args: ParsedRule['args']): void;
toJSON(): T[] | null;
toJSON(): any;
}

@@ -29,0 +29,0 @@ export interface CollectorContract {

@@ -30,14 +30,18 @@ "use strict";

_executeValidations(data, collector, config, bail) {
let passed = true;
let hasFailures = false;
for (let validator of this._childValidators) {
passed = validator.exec(data, collector, config, bail);
if (bail && !passed) {
break;
const passed = validator.exec(data, collector, config, bail);
if (!passed) {
hasFailures = true;
if (bail) {
break;
}
}
}
return passed;
return !hasFailures;
}
async _executeAsyncValidations(data, collector, config, bail) {
let passed = true;
let hasFailures = false;
for (let validator of this._childValidators) {
let passed = true;
if (validator.async) {

@@ -49,7 +53,10 @@ passed = await validator.execAsync(data, collector, config, bail);

}
if (bail && !passed) {
break;
if (!passed) {
hasFailures = true;
if (bail) {
break;
}
}
}
return passed;
return !hasFailures;
}

@@ -65,14 +72,18 @@ exec(data, collector, config, bail = false) {

}
let passed = true;
let index = 0;
let hasFailures = false;
for (let item of dataCopy.parentArray) {
dataCopy.tip = item;
dataCopy.currentIndex = index;
let passed = true;
passed = this._executeValidations(dataCopy, collector, config, bail);
if (bail && !passed) {
break;
if (!passed) {
hasFailures = true;
if (bail) {
break;
}
}
index++;
}
return passed;
return !hasFailures;
}

@@ -88,16 +99,19 @@ async execAsync(data, collector, config, bail = false) {

}
let passed = true;
let index = 0;
let hasFailures = false;
for (let item of dataCopy.parentArray) {
dataCopy.tip = item;
dataCopy.currentIndex = index;
passed = await this._executeAsyncValidations(dataCopy, collector, config, bail);
if (bail && !passed) {
break;
const passed = await this._executeAsyncValidations(dataCopy, collector, config, bail);
if (!passed) {
hasFailures = true;
if (bail) {
break;
}
}
index++;
}
return passed;
return !hasFailures;
}
}
exports.ArrayWrapper = ArrayWrapper;

@@ -11,4 +11,4 @@ "use strict";

const collector = new Collector_1.Collector(new Formatter(), removeAdditional);
let passed = true;
for (let fn of this._fns) {
let passed = false;
if (fn.async) {

@@ -24,8 +24,9 @@ passed = await fn.execAsync(root, collector, config, bail);

}
if (passed) {
const errors = collector.getErrors();
if (!errors) {
return removeAdditional ? collector.getData() : data;
}
throw collector.getErrors();
throw errors;
}
}
exports.Executor = Executor;

@@ -60,5 +60,6 @@ "use strict";

}
let passed = true;
let hasFailures = false;
for (let validation of this._validations) {
let exception = null;
let passed = true;
try {

@@ -72,2 +73,3 @@ passed = validation.fn(dataCopy, this._field, validation.rule.args, config);

if (!passed) {
hasFailures = true;
this._reportErrorToCollector(dataCopy.pointer, validation.rule, collector, exception);

@@ -79,4 +81,4 @@ if (bail) {

}
this._reportValueToCollector(passed, dataCopy, collector);
return passed;
this._reportValueToCollector(!hasFailures, dataCopy, collector);
return !hasFailures;
}

@@ -88,5 +90,6 @@ async execAsync(data, collector, config, bail = false) {

}
let passed = true;
let hasFailures = false;
for (let validation of this._validations) {
let exception = null;
let passed = true;
try {

@@ -105,2 +108,3 @@ if (validation.async) {

if (!passed) {
hasFailures = true;
this._reportErrorToCollector(dataCopy.pointer, validation.rule, collector, exception);

@@ -112,6 +116,6 @@ if (bail) {

}
this._reportValueToCollector(passed, dataCopy, collector);
return passed;
this._reportValueToCollector(!hasFailures, dataCopy, collector);
return !hasFailures;
}
}
exports.ValidationsRunner = ValidationsRunner;
{
"name": "indicative-compiler",
"version": "7.0.1",
"version": "7.0.2",
"description": "Indicative compiler to compile parsed schema into highly optimized functions",

@@ -40,3 +40,3 @@ "main": "build/index.js",

"@adonisjs/mrm-preset": "^2.0.3",
"@types/node": "^12.0.12",
"@types/node": "^12.6.1",
"clone-deep": "^4.0.1",

@@ -59,3 +59,3 @@ "commitizen": "^3.1.1",

"typedoc-plugin-markdown": "^2.0.8",
"typescript": "^3.5.2"
"typescript": "^3.5.3"
},

@@ -62,0 +62,0 @@ "nyc": {

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