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

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 1.6.9 to 1.7.1

es/index.js

4

HISTORY.md
# History
----
## 1.7.0 / 2017-06/09
- add es
- support string patter
## 1.6.0 / 2016-03-30

@@ -5,0 +9,0 @@

40

lib/index.js

@@ -7,6 +7,10 @@ 'use strict';

var _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; };
var _extends2 = require('babel-runtime/helpers/extends');
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _extends3 = _interopRequireDefault(_extends2);
var _typeof2 = require('babel-runtime/helpers/typeof');
var _typeof3 = _interopRequireDefault(_typeof2);
var _util = require('./util');

@@ -20,6 +24,4 @@

var _rule = require('./rule/');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**

@@ -48,3 +50,3 @@ * Encapsulates a validation schema.

}
if ((typeof rules === 'undefined' ? 'undefined' : _typeof(rules)) !== 'object' || Array.isArray(rules)) {
if ((typeof rules === 'undefined' ? 'undefined' : (0, _typeof3['default'])(rules)) !== 'object' || Array.isArray(rules)) {
throw new Error('Rules must be an object');

@@ -121,4 +123,2 @@ }

}
options.error = _rule.error;
var arr = void 0;

@@ -135,3 +135,3 @@ var value = void 0;

if (source === source_) {
source = _extends({}, source);
source = (0, _extends3['default'])({}, source);
}

@@ -145,3 +145,3 @@ value = source[z] = rule.transform(value);

} else {
rule = _extends({}, rule);
rule = (0, _extends3['default'])({}, rule);
}

@@ -167,7 +167,7 @@ rule.validator = _this.getValidationMethod(rule);

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') && ((0, _typeof3['default'])(rule.fields) === 'object' || (0, _typeof3['default'])(rule.defaultField) === 'object');
deep = deep && (rule.required || !rule.required && data.value);
rule.field = data.field;
function addFullfield(key, schema) {
return _extends({}, schema, {
return (0, _extends3['default'])({}, schema, {
fullField: rule.fullField + '.' + key

@@ -206,4 +206,6 @@ });

errors = [].concat(rule.message).map((0, _util.complementError)(rule));
} else if (options.error) {
errors = [options.error(rule, (0, _util.format)(options.messages.required, rule.field))];
} else {
errors = [options.error(rule, (0, _util.format)(options.messages.required, rule.field))];
errors = [];
}

@@ -221,3 +223,3 @@ return doIt(errors);

}
fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
fieldsSchema = (0, _extends3['default'])({}, fieldsSchema, data.rule.fields);
for (var f in fieldsSchema) {

@@ -250,3 +252,3 @@ if (fieldsSchema.hasOwnProperty(f)) {

}
if (typeof rule.validator !== 'function' && rule.type && !_validator2["default"].hasOwnProperty(rule.type)) {
if (typeof rule.validator !== 'function' && rule.type && !_validator2['default'].hasOwnProperty(rule.type)) {
throw new Error((0, _util.format)('Unknown rule type %s', rule.type));

@@ -266,5 +268,5 @@ }

if (keys.length === 1 && keys[0] === 'required') {
return _validator2["default"].required;
return _validator2['default'].required;
}
return _validator2["default"][this.getType(rule)] || false;
return _validator2['default'][this.getType(rule)] || false;
}

@@ -277,3 +279,3 @@ };

}
_validator2["default"][type] = validator;
_validator2['default'][type] = validator;
};

@@ -283,3 +285,3 @@

exports["default"] = Schema;
exports['default'] = Schema;
module.exports = exports['default'];

@@ -9,5 +9,5 @@ 'use strict';

return {
"default": 'Validation error on field %s',
'default': 'Validation error on field %s',
required: '%s is required',
"enum": '%s must be one of %s',
'enum': '%s must be one of %s',
whitespace: '%s cannot be empty',

@@ -26,5 +26,5 @@ date: {

date: '%s is not a %s',
"boolean": '%s is not a %s',
boolean: '%s is not a %s',
integer: '%s is not an %s',
"float": '%s is not a %s',
float: '%s is not a %s',
regexp: '%s is not a valid %s',

@@ -31,0 +31,0 @@ email: '%s is not a valid %s',

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

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }

@@ -34,3 +34,3 @@ var ENUM = 'enum';

exports["default"] = enumerable;
exports['default'] = enumerable;
module.exports = exports['default'];

@@ -6,10 +6,37 @@ 'use strict';

});
exports["default"] = {
required: require('./required'),
whitespace: require('./whitespace'),
type: require('./type'),
range: require('./range'),
"enum": require('./enum'),
pattern: require('./pattern')
var _required = require('./required');
var _required2 = _interopRequireDefault(_required);
var _whitespace = require('./whitespace');
var _whitespace2 = _interopRequireDefault(_whitespace);
var _type = require('./type');
var _type2 = _interopRequireDefault(_type);
var _range = require('./range');
var _range2 = _interopRequireDefault(_range);
var _enum = require('./enum');
var _enum2 = _interopRequireDefault(_enum);
var _pattern = require('./pattern');
var _pattern2 = _interopRequireDefault(_pattern);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
exports['default'] = {
required: _required2['default'],
whitespace: _whitespace2['default'],
type: _type2['default'],
range: _range2['default'],
'enum': _enum2['default'],
pattern: _pattern2['default']
};
module.exports = exports['default'];

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

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }

@@ -26,5 +26,12 @@ /**

function pattern(rule, value, source, errors, options) {
if (rule.pattern instanceof RegExp) {
if (!rule.pattern.test(value)) {
errors.push(util.format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
if (rule.pattern) {
if (rule.pattern instanceof RegExp) {
if (!rule.pattern.test(value)) {
errors.push(util.format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
}
} else if (typeof rule.pattern === 'string') {
var _pattern = new RegExp(rule.pattern);
if (!_pattern.test(value)) {
errors.push(util.format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
}
}

@@ -34,3 +41,3 @@ }

exports["default"] = pattern;
exports['default'] = pattern;
module.exports = exports['default'];

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

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }

@@ -63,3 +63,3 @@ /**

exports["default"] = range;
exports['default'] = range;
module.exports = exports['default'];

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

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }

@@ -31,3 +31,3 @@ /**

exports["default"] = required;
exports['default'] = required;
module.exports = exports['default'];

@@ -7,4 +7,6 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _typeof2 = require('babel-runtime/helpers/typeof');
var _typeof3 = _interopRequireDefault(_typeof2);
var _util = require('../util');

@@ -18,5 +20,5 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -36,3 +38,3 @@ /* eslint max-len:0 */

},
"float": function float(value) {
float: function float(value) {
return types.number(value) && !types.integer(value);

@@ -63,3 +65,3 @@ },

object: function object(value) {
return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && !types.array(value);
return (typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value)) === 'object' && !types.array(value);
},

@@ -93,3 +95,3 @@ method: function method(value) {

if (rule.required && value === undefined) {
(0, _required2["default"])(rule, value, source, errors, options);
(0, _required2['default'])(rule, value, source, errors, options);
return;

@@ -104,3 +106,3 @@ }

// straight typeof check
} else if (ruleType && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== rule.type) {
} else if (ruleType && (typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value)) !== rule.type) {
errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type));

@@ -110,3 +112,3 @@ }

exports["default"] = type;
exports['default'] = type;
module.exports = exports['default'];

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

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }

@@ -31,3 +31,3 @@ /**

exports["default"] = whitespace;
exports['default'] = whitespace;
module.exports = exports['default'];

@@ -6,7 +6,12 @@ 'use strict';

});
exports.warning = undefined;
var _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; };
var _extends2 = require('babel-runtime/helpers/extends');
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _extends3 = _interopRequireDefault(_extends2);
var _typeof2 = require('babel-runtime/helpers/typeof');
var _typeof3 = _interopRequireDefault(_typeof2);
exports.format = format;

@@ -18,2 +23,5 @@ exports.isEmptyValue = isEmptyValue;

exports.deepMerge = deepMerge;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var formatRegExp = /%[sdj%]/g;

@@ -195,4 +203,4 @@

var value = source[s];
if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && _typeof(target[s]) === 'object') {
target[s] = _extends({}, target[s], value);
if ((typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value)) === 'object' && (0, _typeof3['default'])(target[s]) === 'object') {
target[s] = (0, _extends3['default'])({}, target[s], value);
} else {

@@ -199,0 +207,0 @@ target[s] = value;

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -33,6 +33,6 @@ /**

}
_rule2["default"].required(rule, value, source, errors, options, 'array');
_rule2['default'].required(rule, value, source, errors, options, 'array');
if (!(0, _util.isEmptyValue)(value, 'array')) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2["default"].range(rule, value, source, errors, options);
_rule2['default'].type(rule, value, source, errors, options);
_rule2['default'].range(rule, value, source, errors, options);
}

@@ -43,3 +43,3 @@ }

exports["default"] = array;
exports['default'] = array;
module.exports = exports['default'];

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -33,5 +33,5 @@ /**

}
_rule2["default"].required(rule, value, source, errors, options);
_rule2['default'].required(rule, value, source, errors, options);
if (value !== undefined) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2['default'].type(rule, value, source, errors, options);
}

@@ -42,3 +42,3 @@ }

exports["default"] = boolean;
exports['default'] = boolean;
module.exports = exports['default'];

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -25,7 +25,7 @@ function date(rule, value, callback, source, options) {

}
_rule2["default"].required(rule, value, source, errors, options);
_rule2['default'].required(rule, value, source, errors, options);
if (!(0, _util.isEmptyValue)(value)) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2['default'].type(rule, value, source, errors, options);
if (value) {
_rule2["default"].range(rule, value.getTime(), source, errors, options);
_rule2['default'].range(rule, value.getTime(), source, errors, options);
}

@@ -37,3 +37,3 @@ }

exports["default"] = date;
exports['default'] = date;
module.exports = exports['default'];

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -35,5 +35,5 @@ var ENUM = 'enum';

}
_rule2["default"].required(rule, value, source, errors, options);
_rule2['default'].required(rule, value, source, errors, options);
if (value) {
_rule2["default"][ENUM](rule, value, source, errors, options);
_rule2['default'][ENUM](rule, value, source, errors, options);
}

@@ -44,3 +44,3 @@ }

exports["default"] = enumerable;
exports['default'] = enumerable;
module.exports = exports['default'];

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -33,6 +33,6 @@ /**

}
_rule2["default"].required(rule, value, source, errors, options);
_rule2['default'].required(rule, value, source, errors, options);
if (value !== undefined) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2["default"].range(rule, value, source, errors, options);
_rule2['default'].type(rule, value, source, errors, options);
_rule2['default'].range(rule, value, source, errors, options);
}

@@ -43,3 +43,3 @@ }

exports["default"] = floatFn;
exports['default'] = floatFn;
module.exports = exports['default'];
'use strict';
module.exports = {
string: require('./string'),
method: require('./method'),
number: require('./number'),
"boolean": require('./boolean'),
regexp: require('./regexp'),
integer: require('./integer'),
"float": require('./float'),
array: require('./array'),
object: require('./object'),
"enum": require('./enum'),
pattern: require('./pattern'),
email: require('./type'),
url: require('./type'),
date: require('./date'),
hex: require('./type'),
required: require('./required')
};
Object.defineProperty(exports, "__esModule", {
value: true
});
var _string = require('./string');
var _string2 = _interopRequireDefault(_string);
var _method = require('./method');
var _method2 = _interopRequireDefault(_method);
var _number = require('./number');
var _number2 = _interopRequireDefault(_number);
var _boolean = require('./boolean');
var _boolean2 = _interopRequireDefault(_boolean);
var _regexp = require('./regexp');
var _regexp2 = _interopRequireDefault(_regexp);
var _integer = require('./integer');
var _integer2 = _interopRequireDefault(_integer);
var _float = require('./float');
var _float2 = _interopRequireDefault(_float);
var _array = require('./array');
var _array2 = _interopRequireDefault(_array);
var _object = require('./object');
var _object2 = _interopRequireDefault(_object);
var _enum = require('./enum');
var _enum2 = _interopRequireDefault(_enum);
var _pattern = require('./pattern');
var _pattern2 = _interopRequireDefault(_pattern);
var _date = require('./date');
var _date2 = _interopRequireDefault(_date);
var _required = require('./required');
var _required2 = _interopRequireDefault(_required);
var _type = require('./type');
var _type2 = _interopRequireDefault(_type);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
exports['default'] = {
string: _string2['default'],
method: _method2['default'],
number: _number2['default'],
boolean: _boolean2['default'],
regexp: _regexp2['default'],
integer: _integer2['default'],
float: _float2['default'],
array: _array2['default'],
object: _object2['default'],
'enum': _enum2['default'],
pattern: _pattern2['default'],
date: _date2['default'],
url: _type2['default'],
hex: _type2['default'],
email: _type2['default'],
required: _required2['default']
};
module.exports = exports['default'];

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -33,6 +33,6 @@ /**

}
_rule2["default"].required(rule, value, source, errors, options);
_rule2['default'].required(rule, value, source, errors, options);
if (value !== undefined) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2["default"].range(rule, value, source, errors, options);
_rule2['default'].type(rule, value, source, errors, options);
_rule2['default'].range(rule, value, source, errors, options);
}

@@ -43,3 +43,3 @@ }

exports["default"] = integer;
exports['default'] = integer;
module.exports = exports['default'];

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -33,5 +33,5 @@ /**

}
_rule2["default"].required(rule, value, source, errors, options);
_rule2['default'].required(rule, value, source, errors, options);
if (value !== undefined) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2['default'].type(rule, value, source, errors, options);
}

@@ -42,3 +42,3 @@ }

exports["default"] = method;
exports['default'] = method;
module.exports = exports['default'];

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -33,6 +33,6 @@ /**

}
_rule2["default"].required(rule, value, source, errors, options);
_rule2['default'].required(rule, value, source, errors, options);
if (value !== undefined) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2["default"].range(rule, value, source, errors, options);
_rule2['default'].type(rule, value, source, errors, options);
_rule2['default'].range(rule, value, source, errors, options);
}

@@ -43,3 +43,3 @@ }

exports["default"] = number;
exports['default'] = number;
module.exports = exports['default'];

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -33,5 +33,5 @@ /**

}
_rule2["default"].required(rule, value, source, errors, options);
_rule2['default'].required(rule, value, source, errors, options);
if (value !== undefined) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2['default'].type(rule, value, source, errors, options);
}

@@ -42,3 +42,3 @@ }

exports["default"] = object;
exports['default'] = object;
module.exports = exports['default'];

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -36,5 +36,5 @@ /**

}
_rule2["default"].required(rule, value, source, errors, options);
_rule2['default'].required(rule, value, source, errors, options);
if (!(0, _util.isEmptyValue)(value, 'string')) {
_rule2["default"].pattern(rule, value, source, errors, options);
_rule2['default'].pattern(rule, value, source, errors, options);
}

@@ -45,3 +45,3 @@ }

exports["default"] = pattern;
exports['default'] = pattern;
module.exports = exports['default'];

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -33,5 +33,5 @@ /**

}
_rule2["default"].required(rule, value, source, errors, options);
_rule2['default'].required(rule, value, source, errors, options);
if (!(0, _util.isEmptyValue)(value)) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2['default'].type(rule, value, source, errors, options);
}

@@ -42,3 +42,3 @@ }

exports["default"] = regexp;
exports['default'] = regexp;
module.exports = exports['default'];

@@ -7,4 +7,6 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _typeof2 = require('babel-runtime/helpers/typeof');
var _typeof3 = _interopRequireDefault(_typeof2);
var _rule = require('../rule/');

@@ -14,12 +16,12 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function required(rule, value, callback, source, options) {
var errors = [];
var type = Array.isArray(value) ? 'array' : typeof value === 'undefined' ? 'undefined' : _typeof(value);
_rule2["default"].required(rule, value, source, errors, options, type);
var type = Array.isArray(value) ? 'array' : typeof value === 'undefined' ? 'undefined' : (0, _typeof3['default'])(value);
_rule2['default'].required(rule, value, source, errors, options, type);
callback(errors);
}
exports["default"] = required;
exports['default'] = required;
module.exports = exports['default'];

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -33,9 +33,9 @@ /**

}
_rule2["default"].required(rule, value, source, errors, options, 'string');
_rule2['default'].required(rule, value, source, errors, options, 'string');
if (!(0, _util.isEmptyValue)(value, 'string')) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2["default"].range(rule, value, source, errors, options);
_rule2["default"].pattern(rule, value, source, errors, options);
_rule2['default'].type(rule, value, source, errors, options);
_rule2['default'].range(rule, value, source, errors, options);
_rule2['default'].pattern(rule, value, source, errors, options);
if (rule.whitespace === true) {
_rule2["default"].whitespace(rule, value, source, errors, options);
_rule2['default'].whitespace(rule, value, source, errors, options);
}

@@ -47,3 +47,3 @@ }

exports["default"] = string;
exports['default'] = string;
module.exports = exports['default'];

@@ -13,3 +13,3 @@ 'use strict';

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -24,5 +24,5 @@ function type(rule, value, callback, source, options) {

}
_rule2["default"].required(rule, value, source, errors, options, ruleType);
_rule2['default'].required(rule, value, source, errors, options, ruleType);
if (!(0, _util.isEmptyValue)(value, ruleType)) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2['default'].type(rule, value, source, errors, options);
}

@@ -33,3 +33,3 @@ }

exports["default"] = type;
exports['default'] = type;
module.exports = exports['default'];
{
"name": "async-validator",
"version": "1.6.9",
"version": "1.7.1",
"description": "validate form asynchronous",

@@ -17,5 +17,15 @@ "keywords": [

"files": [
"lib"
"lib",
"es"
],
"main": "./lib/index",
"module": "./es/index",
"jest": {
"collectCoverageFrom": [
"src/*"
],
"transform": {
"\\.jsx?$": "./node_modules/rc-tools/scripts/jestPreprocessor.js"
}
},
"bugs": {

@@ -32,18 +42,18 @@ "url": "http://github.com/yiminghe/async-validator/issues"

"start": "rc-tools run server",
"pub": "rc-tools run pub",
"pub": "rc-tools run pub --babel-runtime",
"lint": "rc-tools run lint",
"karma": "rc-tools run karma",
"saucelabs": "rc-tools run saucelabs",
"test": "rc-tools run test",
"chrome-test": "rc-tools run chrome-test",
"coverage": "rc-tools run coverage"
"test": "jest",
"coverage": "jest --coverage && cat ./coverage/lcov.info | coveralls"
},
"devDependencies": {
"expect.js": "~0.3.1",
"jest": "20.x",
"pre-commit": "1.x",
"rc-tools": "5.x"
"rc-tools": "6.x"
},
"pre-commit": [
"lint"
]
],
"dependencies": {
"babel-runtime": "6.x"
}
}
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