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

async-validate

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-validate - npm Package Compare versions

Comparing version 0.4.13 to 0.4.14

doc/example/string.js

1

doc/readme/guide.md

@@ -223,2 +223,3 @@ ## Guide

* `method`: Must be of type `function`.
* `null`: Must strictly equal `null`.
* `regexp`: Must be an instance of `RegExp` or a string that does not generate an exception when creating a new `RegExp`.

@@ -225,0 +226,0 @@ * `integer`: Must be of type `number` and an integer.

var types = {};
types.null = function(value) {
return value === null;
}
types.integer = function(value) {

@@ -4,0 +8,0 @@ return typeof(value) === 'number' && parseInt(value) === value;

5

lib/validator.js

@@ -121,3 +121,4 @@ var plugin = require('zephyr')

function type() {
var custom = ['integer', 'float', 'array', 'regexp', 'object', 'method']
var custom = [
'integer', 'float', 'array', 'regexp', 'object', 'method', 'null']
, rule = this.rule

@@ -130,3 +131,3 @@ , value = this.value

// no need to add this error message
if(rule.required && (value === undefined || value === null)) {
if(rule.required && (value === undefined)) {
return;

@@ -133,0 +134,0 @@ }

@@ -16,2 +16,3 @@ /**

string: '%s is not a %s',
null: '%s is not %s',
method: '%s is not a %s (function)',

@@ -18,0 +19,0 @@ array: '%s is not an %s',

{
"name": "async-validate",
"description": "Asynchronous validation for object properties.",
"version": "0.4.13",
"version": "0.4.14",
"author": "muji <noop@xpm.io>",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -10,2 +10,3 @@ var validator = require('../lib/validator');

require('./method'),
require('./null'),
require('./number'),

@@ -12,0 +13,0 @@ require('./object'),

@@ -315,2 +315,3 @@ Table of Contents

* `method`: Must be of type `function`.
* `null`: Must strictly equal `null`.
* `regexp`: Must be an instance of `RegExp` or a string that does not generate an exception when creating a new `RegExp`.

@@ -317,0 +318,0 @@ * `integer`: Must be of type `number` and an integer.

@@ -54,5 +54,5 @@ var assert = require('chai').assert;

validator.validate({name: null}, function(errors, fields) {
assert.equal(errors.length, 1);
assert.equal(errors.length, 2);
assert.equal(errors[0].message, "name is required");
assert.equal(fields.name.length, 1);
assert.equal(fields.name.length, 2);
done();

@@ -59,0 +59,0 @@ });

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