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.1.0 to 3.2.0

29

dist-node/index.js

@@ -919,2 +919,28 @@ 'use strict';

/**
* Performs validation for any type.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function any(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value) && !rule.required) {
return callback();
}
rules.required(rule, value, source, errors, options);
}
callback(errors);
}
var validators = {

@@ -936,3 +962,4 @@ string: string,

email: type$1,
required: required$1
required: required$1,
any: any
};

@@ -939,0 +966,0 @@

3

dist-types/index.d.ts

@@ -38,3 +38,4 @@ // Type definitions for async-validator 3.0.4

| 'hex'
| 'email';
| 'email'
| 'any';

@@ -41,0 +42,0 @@ interface RuleItem {

@@ -914,2 +914,28 @@ function _extends() {

/**
* Performs validation for any type.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function any(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if (isEmptyValue(value) && !rule.required) {
return callback();
}
rules.required(rule, value, source, errors, options);
}
callback(errors);
}
var validators = {

@@ -931,3 +957,4 @@ string: string,

email: type$1,
required: required$1
required: required$1,
any: any
};

@@ -934,0 +961,0 @@

{
"name": "async-validator",
"description": "validate form asynchronous",
"version": "3.1.0",
"version": "3.2.0",
"license": "MIT",

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

@@ -174,2 +174,3 @@ # async-validator

* `email`: Must be of type `email`.
* `any`: Can be any type.

@@ -176,0 +177,0 @@ #### Required

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