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

consultant

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

consultant - npm Package Compare versions

Comparing version 0.1.26 to 0.1.27

5

lib/Input.d.ts
import { RuleCollection } from './Rule';
import { ValidationResult } from './Validator';
export interface PickResult {
items: Input;
export interface ConsumeResult extends ValidationResult {
remainder: Input;

@@ -11,4 +10,4 @@ }

validate(rules: RuleCollection): ValidationResult;
pick(keys: string[]): PickResult;
consume(rules: RuleCollection): ConsumeResult;
}
export default Input;

9

lib/Input.js

@@ -13,8 +13,7 @@ "use strict";

};
Input.prototype.pick = function (keys) {
var picked = immunity.pickFromObject(this.source, keys);
return {
items: new Input(picked.items),
Input.prototype.consume = function (rules) {
var picked = immunity.pickFromObject(this.source, Object.keys(rules));
return Object.assign({
remainder: new Input(picked.remainder)
};
}, this.validate(rules));
};

@@ -21,0 +20,0 @@ return Input;

@@ -46,14 +46,13 @@ "use strict";

var errors = [];
if (rule.validate === undefined) {
return [];
if (rule.validate !== undefined) {
item.value.forEach(function (currentValue) {
var validationMethodResult = rule.validate(currentValue);
if (validationMethodResult !== true) {
errors = errors.concat([
{ error: "validation failed. value is \"" + currentValue + "\": " + validationMethodResult }
]);
}
});
}
item.value.forEach(function (currentValue) {
var validationMethodResult = rule.validate(currentValue);
if (validationMethodResult !== true) {
return [
{ error: "validation failed. value is \"" + currentValue + "\": " + validationMethodResult }
];
}
});
return [];
return errors;
};

@@ -91,3 +90,3 @@ Validator.prototype.findValues = function (rule, argv, key) {

var resultErrors = {};
var isValid = false;
var isValid = true;
for (var _i = 0, _a = Object.keys(rules); _i < _a.length; _i++) {

@@ -116,3 +115,3 @@ var ruleKey = _a[_i];

if (item.errors.length > 0) {
isValid = true;
isValid = false;
resultErrors = immunity.appendToObject(resultErrors, (_c = {},

@@ -119,0 +118,0 @@ _c[ruleKey] = item.errors,

@@ -19,3 +19,3 @@ {

],
"version": "0.1.26",
"version": "0.1.27",
"homepage": "",

@@ -22,0 +22,0 @@ "author": "Eser Ozvataf <eser@ozvataf.com>",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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