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 1.4.1 to 1.4.2

6

lib/util.js

@@ -50,2 +50,6 @@ 'use strict';

function isNativeStringType(type) {
return type === 'string' || type === 'url' || type === 'hex' || type === 'email';
}
function isEmptyValue(value, type) {

@@ -58,3 +62,3 @@ if (value === undefined || value === null) {

}
if (type === 'string' && typeof value === 'string' && !value) {
if (isNativeStringType(type) && typeof value === 'string' && !value) {
return true;

@@ -61,0 +65,0 @@ }

@@ -13,5 +13,17 @@ 'use strict';

var _util = require('../util');
function type(rule, value, callback, source, options) {
var ruleType = rule.type;
var errors = [];
_rule2['default'].type(rule, value, source, errors, options);
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value, ruleType) && !rule.required) {
return callback();
}
_rule2['default'].required(rule, value, source, errors, options, ruleType);
if (!(0, _util.isEmptyValue)(value, ruleType)) {
_rule2['default'].type(rule, value, source, errors, options);
}
}
callback(errors);

@@ -18,0 +30,0 @@ }

2

package.json
{
"name": "async-validator",
"version": "1.4.1",
"version": "1.4.2",
"description": "validate form asynchronous",

@@ -5,0 +5,0 @@ "keywords": [

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