New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.1.14 to 0.1.15

2

lib/rule/required.js

@@ -18,3 +18,3 @@ var util = require('util');

&& (!source.hasOwnProperty(rule.field)
|| value === undefined)) {
|| value === undefined || value === null)) {
errors.push(error(rule,

@@ -21,0 +21,0 @@ util.format(options.messages.required, rule.field)));

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

@@ -6,0 +6,0 @@ "repository": {

@@ -50,2 +50,14 @@ var util = require('util');

});
test("validate a required string field (null)", function() {
var descriptor = {
name: {type: "string", required: true}
}
var validator = new schema(descriptor);
validator.validate({name: null}, function(errors, fields) {
assert.equal(errors.length, 1);
assert.equal(errors[0].message, "name is required");
assert.equal(fields.name.length, 1);
assert.isTrue((fields.name[0] instanceof ValidationError));
});
});
test("validate a field of type string is of the correct type", function() {

@@ -52,0 +64,0 @@ var descriptor = {

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