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

extensible-validator

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extensible-validator - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

dist/ArraySchema.d.ts

2

dist/DateSchema.js

@@ -15,4 +15,2 @@ "use strict";

this.typeTest = function (value) {
console.log({ value });
console.log(this._parseFormat);
return (value === '' ||

@@ -19,0 +17,0 @@ value == null ||

@@ -0,1 +1,2 @@

export * from './ArraySchema';
export * from './DateSchema';

@@ -2,0 +3,0 @@ export * from './NumberSchema';

@@ -6,2 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./ArraySchema"));
__export(require("./DateSchema"));

@@ -8,0 +9,0 @@ __export(require("./NumberSchema"));

@@ -19,5 +19,5 @@ import { Schema, ValidationResult } from './Schema';

[key: string]: any;
}, _context?: ValidationContext): ValidationResult;
}, context?: ValidationContext): ValidationResult;
cast(value: any): any;
}
export declare const object: ObjectSchema<{}>;

@@ -25,16 +25,9 @@ "use strict";

}
_validateKeys(values, _context) {
const results = [];
const context = _context
? Object.assign({}, _context)
: { model: values, path: null };
_validateKeys(values, context = { model: values, path: null }) {
const basePath = context.path ? context.path + '.' : '';
if (values == null)
return [];
for (const key in this.keyValidation) {
context.path = basePath + key;
const result = this.keyValidation[key].validate(values[key], context);
results.push(...result);
}
return results;
return _.flatMap(this.keyValidation, (schema, key) => {
return schema.validate(values[key], Object.assign({}, context, { path: basePath + key }));
});
}

@@ -45,7 +38,5 @@ cast(value) {

}
const result = {};
for (const k in this.keyValidation) {
result[k] = this.keyValidation[k].cast(value[k]);
}
return result;
return _.mapValues(this.keyValidation, (schema, key) => {
return schema.cast(value[key]);
});
}

@@ -52,0 +43,0 @@ }

{
"name": "extensible-validator",
"version": "2.0.2",
"version": "2.1.0",
"description": "Typescript-friendly and extensible object and value validation",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

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