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.0.2 to 3.0.3

242

dist-node/index.js

@@ -5,64 +5,19 @@ 'use strict';

function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(source, true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(source).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
return target;
}
return target;
};
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
return _extends.apply(this, arguments);
}
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
/* eslint no-console:0 */

@@ -74,3 +29,3 @@

if (process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') {
if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') {
warning = function warning(type, errors) {

@@ -142,3 +97,3 @@ if (typeof console !== 'undefined' && console.warn) {

for (var arg = args[i]; i < len; arg = args[++i]) {
str += " ".concat(arg);
str += " " + arg;
}

@@ -302,4 +257,4 @@

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

@@ -351,15 +306,2 @@ target[s] = value;

function _typeof$1(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof$1 = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof$1 = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof$1(obj);
}
/* eslint max-len:0 */

@@ -405,3 +347,3 @@

object: function object(value) {
return _typeof$1(value) === 'object' && !types.array(value);
return typeof value === 'object' && !types.array(value);
},

@@ -447,3 +389,3 @@ method: function method(value) {

} else if (ruleType && _typeof$1(value) !== rule.type) {
} else if (ruleType && typeof value !== rule.type) {
errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));

@@ -957,19 +899,5 @@ }

function _typeof$2(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof$2 = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof$2 = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof$2(obj);
}
function required$1(rule, value, callback, source, options) {
var errors = [];
var type = Array.isArray(value) ? 'array' : _typeof$2(value);
var type = Array.isArray(value) ? 'array' : typeof value;
rules.required(rule, value, source, errors, options, type);

@@ -1074,86 +1002,19 @@ callback(errors);

function ownKeys$1(object, enumerableOnly) {
var keys = Object.keys(object);
function _extends$1() {
_extends$1 = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread$1(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys$1(source, true).forEach(function (key) {
_defineProperty$1(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys$1(source).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
return target;
}
return target;
};
function _defineProperty$1(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
return _extends$1.apply(this, arguments);
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
}
}
function _typeof$3(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof$3 = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof$3 = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof$3(obj);
}
/**

@@ -1185,3 +1046,3 @@ * Encapsulates a validation schema.

if (_typeof$3(rules) !== 'object' || Array.isArray(rules)) {
if (typeof rules !== 'object' || Array.isArray(rules)) {
throw new Error('Rules must be an object');

@@ -1201,7 +1062,13 @@ }

},
validate: function validate(source_) {
validate: function validate(source_, o, oc) {
var _this = this;
var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var oc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
if (o === void 0) {
o = {};
}
if (oc === void 0) {
oc = function oc() {};
}
var source = source_;

@@ -1233,3 +1100,3 @@ var options = o;

errors = (_errors = errors).concat.apply(_errors, _toConsumableArray(e));
errors = (_errors = errors).concat.apply(_errors, e);
} else {

@@ -1279,3 +1146,3 @@ errors.push(e);

if (source === source_) {
source = _objectSpread$1({}, source);
source = _extends$1({}, source);
}

@@ -1291,3 +1158,3 @@

} else {
rule = _objectSpread$1({}, rule);
rule = _extends$1({}, rule);
}

@@ -1316,3 +1183,3 @@

var rule = data.rule;
var deep = (rule.type === 'object' || rule.type === 'array') && (_typeof$3(rule.fields) === 'object' || _typeof$3(rule.defaultField) === 'object');
var deep = (rule.type === 'object' || rule.type === 'array') && (typeof rule.fields === 'object' || typeof rule.defaultField === 'object');
deep = deep && (rule.required || !rule.required && data.value);

@@ -1322,9 +1189,12 @@ rule.field = data.field;

function addFullfield(key, schema) {
return _objectSpread$1({}, schema, {
fullField: "".concat(rule.fullField, ".").concat(key)
return _extends$1({}, schema, {
fullField: rule.fullField + "." + key
});
}
function cb() {
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
function cb(e) {
if (e === void 0) {
e = [];
}
var errors = e;

@@ -1379,3 +1249,3 @@

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

@@ -1401,7 +1271,7 @@ for (var f in fieldsSchema) {

if (errors && errors.length) {
finalErrors.push.apply(finalErrors, _toConsumableArray(errors));
finalErrors.push.apply(finalErrors, errors);
}
if (errs && errs.length) {
finalErrors.push.apply(finalErrors, _toConsumableArray(errs));
finalErrors.push.apply(finalErrors, errs);
}

@@ -1424,3 +1294,3 @@

} else if (res === false) {
cb(rule.message || "".concat(rule.field, " fails"));
cb(rule.message || rule.field + " fails");
} else if (res instanceof Array) {

@@ -1427,0 +1297,0 @@ cb(res);

@@ -1,17 +0,3 @@

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
import { format, complementError, asyncMap, warning, deepMerge, convertFieldsError } from "./util.js";

@@ -46,3 +32,3 @@ import validators from "./validator/index.js";

if (_typeof(rules) !== 'object' || Array.isArray(rules)) {
if (typeof rules !== 'object' || Array.isArray(rules)) {
throw new Error('Rules must be an object');

@@ -62,7 +48,13 @@ }

},
validate: function validate(source_) {
validate: function validate(source_, o, oc) {
var _this = this;
var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var oc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
if (o === void 0) {
o = {};
}
if (oc === void 0) {
oc = function oc() {};
}
var source = source_;

@@ -94,3 +86,3 @@ var options = o;

errors = (_errors = errors).concat.apply(_errors, _toConsumableArray(e));
errors = (_errors = errors).concat.apply(_errors, e);
} else {

@@ -140,3 +132,3 @@ errors.push(e);

if (source === source_) {
source = _objectSpread({}, source);
source = _extends({}, source);
}

@@ -152,3 +144,3 @@

} else {
rule = _objectSpread({}, rule);
rule = _extends({}, rule);
}

@@ -177,3 +169,3 @@

var rule = data.rule;
var deep = (rule.type === 'object' || rule.type === 'array') && (_typeof(rule.fields) === 'object' || _typeof(rule.defaultField) === 'object');
var deep = (rule.type === 'object' || rule.type === 'array') && (typeof rule.fields === 'object' || typeof rule.defaultField === 'object');
deep = deep && (rule.required || !rule.required && data.value);

@@ -183,9 +175,12 @@ rule.field = data.field;

function addFullfield(key, schema) {
return _objectSpread({}, schema, {
fullField: "".concat(rule.fullField, ".").concat(key)
return _extends({}, schema, {
fullField: rule.fullField + "." + key
});
}
function cb() {
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
function cb(e) {
if (e === void 0) {
e = [];
}
var errors = e;

@@ -240,3 +235,3 @@

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

@@ -262,7 +257,7 @@ for (var f in fieldsSchema) {

if (errors && errors.length) {
finalErrors.push.apply(finalErrors, _toConsumableArray(errors));
finalErrors.push.apply(finalErrors, errors);
}
if (errs && errs.length) {
finalErrors.push.apply(finalErrors, _toConsumableArray(errs));
finalErrors.push.apply(finalErrors, errs);
}

@@ -285,3 +280,3 @@

} else if (res === false) {
cb(rule.message || "".concat(rule.field, " fails"));
cb(rule.message || rule.field + " fails");
} else if (res instanceof Array) {

@@ -288,0 +283,0 @@ cb(res);

@@ -1,3 +0,1 @@

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
import * as util from "../util.js";

@@ -45,3 +43,3 @@ import required from "./required.js";

object: function object(value) {
return _typeof(value) === 'object' && !types.array(value);
return typeof value === 'object' && !types.array(value);
},

@@ -87,3 +85,3 @@ method: function method(value) {

} else if (ruleType && _typeof(value) !== rule.type) {
} else if (ruleType && typeof value !== rule.type) {
errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type));

@@ -90,0 +88,0 @@ }

@@ -1,9 +0,3 @@

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/* eslint no-console:0 */

@@ -13,3 +7,3 @@ var formatRegExp = /%[sdj%]/g;

if (process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') {
if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') {
warning = function warning(type, errors) {

@@ -81,3 +75,3 @@ if (typeof console !== 'undefined' && console.warn) {

for (var arg = args[i]; i < len; arg = args[++i]) {
str += " ".concat(arg);
str += " " + arg;
}

@@ -244,4 +238,4 @@

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

@@ -248,0 +242,0 @@ target[s] = value;

@@ -1,3 +0,1 @@

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
import rules from '../rule/index.js';

@@ -7,3 +5,3 @@

var errors = [];
var type = Array.isArray(value) ? 'array' : _typeof(value);
var type = Array.isArray(value) ? 'array' : typeof value;
rules.required(rule, value, source, errors, options, type);

@@ -10,0 +8,0 @@ callback(errors);

@@ -1,84 +0,19 @@

function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
return _typeof(obj);
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(source, true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(source).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
return target;
}
return target;
};
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
return _extends.apply(this, arguments);
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
}
}
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}
/* eslint no-console:0 */

@@ -88,3 +23,3 @@ var formatRegExp = /%[sdj%]/g;

if (process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') {
if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') {
warning = function warning(type, errors) {

@@ -156,3 +91,3 @@ if (typeof console !== 'undefined' && console.warn) {

for (var arg = args[i]; i < len; arg = args[++i]) {
str += " ".concat(arg);
str += " " + arg;
}

@@ -316,4 +251,4 @@

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

@@ -405,3 +340,3 @@ target[s] = value;

object: function object(value) {
return _typeof(value) === 'object' && !types.array(value);
return typeof value === 'object' && !types.array(value);
},

@@ -447,3 +382,3 @@ method: function method(value) {

} else if (ruleType && _typeof(value) !== rule.type) {
} else if (ruleType && typeof value !== rule.type) {
errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));

@@ -959,3 +894,3 @@ }

var errors = [];
var type = Array.isArray(value) ? 'array' : _typeof(value);
var type = Array.isArray(value) ? 'array' : typeof value;
rules.required(rule, value, source, errors, options, type);

@@ -1086,3 +1021,3 @@ callback(errors);

if (_typeof(rules) !== 'object' || Array.isArray(rules)) {
if (typeof rules !== 'object' || Array.isArray(rules)) {
throw new Error('Rules must be an object');

@@ -1102,7 +1037,13 @@ }

},
validate: function validate(source_) {
validate: function validate(source_, o, oc) {
var _this = this;
var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var oc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
if (o === void 0) {
o = {};
}
if (oc === void 0) {
oc = function oc() {};
}
var source = source_;

@@ -1134,3 +1075,3 @@ var options = o;

errors = (_errors = errors).concat.apply(_errors, _toConsumableArray(e));
errors = (_errors = errors).concat.apply(_errors, e);
} else {

@@ -1180,3 +1121,3 @@ errors.push(e);

if (source === source_) {
source = _objectSpread2({}, source);
source = _extends({}, source);
}

@@ -1192,3 +1133,3 @@

} else {
rule = _objectSpread2({}, rule);
rule = _extends({}, rule);
}

@@ -1217,3 +1158,3 @@

var rule = data.rule;
var deep = (rule.type === 'object' || rule.type === 'array') && (_typeof(rule.fields) === 'object' || _typeof(rule.defaultField) === 'object');
var deep = (rule.type === 'object' || rule.type === 'array') && (typeof rule.fields === 'object' || typeof rule.defaultField === 'object');
deep = deep && (rule.required || !rule.required && data.value);

@@ -1223,9 +1164,12 @@ rule.field = data.field;

function addFullfield(key, schema) {
return _objectSpread2({}, schema, {
fullField: "".concat(rule.fullField, ".").concat(key)
return _extends({}, schema, {
fullField: rule.fullField + "." + key
});
}
function cb() {
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
function cb(e) {
if (e === void 0) {
e = [];
}
var errors = e;

@@ -1280,3 +1224,3 @@

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

@@ -1302,7 +1246,7 @@ for (var f in fieldsSchema) {

if (errors && errors.length) {
finalErrors.push.apply(finalErrors, _toConsumableArray(errors));
finalErrors.push.apply(finalErrors, errors);
}
if (errs && errs.length) {
finalErrors.push.apply(finalErrors, _toConsumableArray(errs));
finalErrors.push.apply(finalErrors, errs);
}

@@ -1325,3 +1269,3 @@

} else if (res === false) {
cb(rule.message || "".concat(rule.field, " fails"));
cb(rule.message || rule.field + " fails");
} else if (res instanceof Array) {

@@ -1328,0 +1272,0 @@ cb(res);

{
"name": "async-validator",
"description": "validate form asynchronous",
"version": "3.0.2",
"version": "3.0.3",
"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