Socket
Socket
Sign inDemoInstall

async-validator

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-validator - npm Package Compare versions

Comparing version 3.2.4 to 3.3.0

123

dist-node/index.js

@@ -23,2 +23,92 @@ 'use strict';

function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
/* eslint no-console:0 */

@@ -174,2 +264,16 @@ var formatRegExp = /%[sdj%]/g;

var AsyncValidationError = /*#__PURE__*/function (_Error) {
_inheritsLoose(AsyncValidationError, _Error);
function AsyncValidationError(errors, fields) {
var _this;
_this = _Error.call(this, 'Async Validation Error') || this;
_this.errors = errors;
_this.fields = fields;
return _this;
}
return AsyncValidationError;
}( /*#__PURE__*/_wrapNativeSuper(Error));
function asyncMap(objArr, option, func, callback) {

@@ -180,6 +284,3 @@ if (option.first) {

callback(errors);
return errors.length ? reject({
errors: errors,
fields: convertFieldsError(errors)
}) : resolve();
return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve();
};

@@ -215,6 +316,3 @@

callback(results);
return results.length ? reject({
errors: results,
fields: convertFieldsError(results)
}) : resolve();
return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve();
}

@@ -263,3 +361,3 @@ };

if (typeof value === 'object' && typeof target[s] === 'object') {
target[s] = _extends({}, target[s], {}, value);
target[s] = _extends(_extends({}, target[s]), value);
} else {

@@ -1193,3 +1291,3 @@ target[s] = value;

function addFullfield(key, schema) {
return _extends({}, schema, {
return _extends(_extends({}, schema), {}, {
fullField: rule.fullField + "." + key

@@ -1236,4 +1334,2 @@ });

errors = [options.error(rule, format(options.messages.required, rule.field))];
} else {
errors = [];
}

@@ -1254,3 +1350,3 @@

fieldsSchema = _extends({}, fieldsSchema, {}, data.rule.fields);
fieldsSchema = _extends(_extends({}, fieldsSchema), data.rule.fields);

@@ -1358,4 +1454,5 @@ for (var f in fieldsSchema) {

Schema.messages = messages;
Schema.validators = validators;
exports.default = Schema;
//# sourceMappingURL=index.js.map

@@ -19,2 +19,92 @@ function _extends() {

function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}
/* eslint no-console:0 */

@@ -170,2 +260,16 @@ var formatRegExp = /%[sdj%]/g;

var AsyncValidationError = /*#__PURE__*/function (_Error) {
_inheritsLoose(AsyncValidationError, _Error);
function AsyncValidationError(errors, fields) {
var _this;
_this = _Error.call(this, 'Async Validation Error') || this;
_this.errors = errors;
_this.fields = fields;
return _this;
}
return AsyncValidationError;
}( /*#__PURE__*/_wrapNativeSuper(Error));
function asyncMap(objArr, option, func, callback) {

@@ -176,6 +280,3 @@ if (option.first) {

callback(errors);
return errors.length ? reject({
errors: errors,
fields: convertFieldsError(errors)
}) : resolve();
return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve();
};

@@ -211,6 +312,3 @@

callback(results);
return results.length ? reject({
errors: results,
fields: convertFieldsError(results)
}) : resolve();
return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve();
}

@@ -259,3 +357,3 @@ };

if (typeof value === 'object' && typeof target[s] === 'object') {
target[s] = _extends({}, target[s], {}, value);
target[s] = _extends(_extends({}, target[s]), value);
} else {

@@ -1189,3 +1287,3 @@ target[s] = value;

function addFullfield(key, schema) {
return _extends({}, schema, {
return _extends(_extends({}, schema), {}, {
fullField: rule.fullField + "." + key

@@ -1232,4 +1330,2 @@ });

errors = [options.error(rule, format(options.messages.required, rule.field))];
} else {
errors = [];
}

@@ -1250,3 +1346,3 @@

fieldsSchema = _extends({}, fieldsSchema, {}, data.rule.fields);
fieldsSchema = _extends(_extends({}, fieldsSchema), data.rule.fields);

@@ -1354,4 +1450,5 @@ for (var f in fieldsSchema) {

Schema.messages = messages;
Schema.validators = validators;
export default Schema;
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "async-validator",
"description": "validate form asynchronous",
"version": "3.2.4",
"version": "3.3.0",
"license": "MIT",

@@ -6,0 +6,0 @@ "files": [

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