Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

ajv

Package Overview
Dependencies
Maintainers
2
Versions
357
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ajv - npm Package Compare versions

Comparing version
6.12.6
to
6.14.0
+5
-0
lib/ajv.d.ts

@@ -206,4 +206,9 @@ declare var ajv: {

serialize?: ((schema: object | boolean) => any) | false;
regExp?: (pattern: string) => RegExpLike;
}
interface RegExpLike {
test: (s: string) => boolean;
}
type FormatValidator = string | RegExp | ((data: string) => boolean | PromiseLike<any>);

@@ -210,0 +215,0 @@ type NumberFormatValidator = ((data: number) => boolean | PromiseLike<any>);

+8
-6

@@ -45,2 +45,7 @@ 'use strict';

function patternCode(i, patterns) {
var regExpCode = opts.regExp ? 'regExp' : 'new RegExp';
return 'var pattern' + i + ' = ' + regExpCode + '(' + util.toQuotedString(patterns[i]) + ');';
}
root = root || { schema: schema, refVal: refVal, refs: refs };

@@ -132,2 +137,3 @@

'ValidationError',
'regExp',
sourceCode

@@ -146,3 +152,4 @@ );

ucs2length,
ValidationError
ValidationError,
opts.regExp
);

@@ -364,7 +371,2 @@

function patternCode(i, patterns) {
return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');';
}
function defaultCode(i) {

@@ -371,0 +373,0 @@ return 'var default' + i + ' = defaults[' + i + '];';

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

var $data = 'data' + ($dataLvl || '');
var $valid = 'valid' + $lvl;
var $isData = it.opts.$data && $schema && $schema.$data,

@@ -20,8 +21,17 @@ $schemaValue;

}
var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema);
out += 'if ( ';
var $regExpCode = it.opts.regExp ? 'regExp' : 'new RegExp';
if ($isData) {
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
out += ' var ' + ($valid) + ' = true; try { ' + ($valid) + ' = ' + ($regExpCode) + '(' + ($schemaValue) + ').test(' + ($data) + '); } catch(e) { ' + ($valid) + ' = false; } if ( ';
if ($isData) {
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
}
out += ' !' + ($valid) + ') {';
} else {
var $regexp = it.usePattern($schema);
out += ' if ( ';
if ($isData) {
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
}
out += ' !' + ($regexp) + '.test(' + ($data) + ') ) {';
}
out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { ';
var $$outStack = $$outStack || [];

@@ -28,0 +38,0 @@ $$outStack.push(out);

{
"name": "ajv",
"version": "6.12.6",
"version": "6.14.0",
"description": "Another JSON Schema Validator",

@@ -93,2 +93,3 @@ "main": "lib/ajv.js",

"pre-commit": "^1.1.1",
"re2": "^1.21.4",
"require-globify": "^1.3.0",

@@ -95,0 +96,0 @@ "typescript": "^3.9.5",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display