New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

handcuffs

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handcuffs - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

31

dist/browser/cjs/index.js

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

alphaNum: 'This field may only contain letters and numbers',
alphaNumDash: 'This field may only contain letters, numbers, and dashes',
alphaNumDash: 'This field may only contain letters, numbers, dashes and underscores',
array: 'This field must be an array',

@@ -275,2 +275,3 @@ between: {

var numericRules = ['numeric'];
var mandatoryRules = ['accepted', 'required'];
function addRule(title, ruleFunction, message) {

@@ -301,2 +302,9 @@ if (!title || !ruleFunction || !message) {

}
function mandatoryRule(rule, value) {
if (mandatoryRules.includes(rule)) {
return true;
}
return value !== undefined;
}
function getRuleValidationFunction(rule) {

@@ -385,3 +393,3 @@ var validationFunction = validationRules[rule];

if (!(i < parsedRules.length)) {
_context.next = 14;
_context.next = 15;
break;

@@ -393,10 +401,15 @@ }

_context.next = 7;
if (!mandatoryRule(rule.title, value)) {
_context.next = 12;
break;
}
_context.next = 8;
return ruleValidationFunction(value, rule.params);
case 7:
case 8:
ruleValid = _context.sent;
if (ruleValid) {
_context.next = 11;
_context.next = 12;
break;

@@ -406,5 +419,5 @@ }

errorMessage = formatErrorMessage(rule, parsedRules);
return _context.abrupt('break', 14);
return _context.abrupt('break', 15);
case 11:
case 12:
i += 1;

@@ -414,6 +427,6 @@ _context.next = 2;

case 14:
case 15:
return _context.abrupt('return', errorMessage);
case 15:
case 16:
case 'end':

@@ -420,0 +433,0 @@ return _context.stop();

@@ -124,3 +124,3 @@ import isNumber from 'is-number';

alphaNum: 'This field may only contain letters and numbers',
alphaNumDash: 'This field may only contain letters, numbers, and dashes',
alphaNumDash: 'This field may only contain letters, numbers, dashes and underscores',
array: 'This field must be an array',

@@ -267,2 +267,3 @@ between: {

var numericRules = ['numeric'];
var mandatoryRules = ['accepted', 'required'];
function addRule(title, ruleFunction, message) {

@@ -293,2 +294,9 @@ if (!title || !ruleFunction || !message) {

}
function mandatoryRule(rule, value) {
if (mandatoryRules.includes(rule)) {
return true;
}
return value !== undefined;
}
function getRuleValidationFunction(rule) {

@@ -377,3 +385,3 @@ var validationFunction = validationRules[rule];

if (!(i < parsedRules.length)) {
_context.next = 14;
_context.next = 15;
break;

@@ -385,10 +393,15 @@ }

_context.next = 7;
if (!mandatoryRule(rule.title, value)) {
_context.next = 12;
break;
}
_context.next = 8;
return ruleValidationFunction(value, rule.params);
case 7:
case 8:
ruleValid = _context.sent;
if (ruleValid) {
_context.next = 11;
_context.next = 12;
break;

@@ -398,5 +411,5 @@ }

errorMessage = formatErrorMessage(rule, parsedRules);
return _context.abrupt('break', 14);
return _context.abrupt('break', 15);
case 11:
case 12:
i += 1;

@@ -406,6 +419,6 @@ _context.next = 2;

case 14:
case 15:
return _context.abrupt('return', errorMessage);
case 15:
case 16:
case 'end':

@@ -412,0 +425,0 @@ return _context.stop();

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

alphaNum: 'This field may only contain letters and numbers',
alphaNumDash: 'This field may only contain letters, numbers, and dashes',
alphaNumDash: 'This field may only contain letters, numbers, dashes and underscores',
array: 'This field must be an array',

@@ -152,2 +152,3 @@ between: {

const numericRules = ['numeric'];
const mandatoryRules = ['accepted', 'required'];
function addRule(title, ruleFunction, message) {

@@ -174,2 +175,9 @@ if (!title || !ruleFunction || !message) {

}
function mandatoryRule(rule, value) {
if (mandatoryRules.includes(rule)) {
return true;
}
return value !== undefined;
}
function getRuleValidationFunction(rule) {

@@ -244,7 +252,9 @@ const validationFunction = validationRules[rule];

const ruleValid = await ruleValidationFunction(value, rule.params);
if (mandatoryRule(rule.title, value)) {
const ruleValid = await ruleValidationFunction(value, rule.params);
if (!ruleValid) {
errorMessage = formatErrorMessage(rule, parsedRules);
break;
if (!ruleValid) {
errorMessage = formatErrorMessage(rule, parsedRules);
break;
}
}

@@ -251,0 +261,0 @@ }

@@ -8,3 +8,3 @@ import isNumber from 'is-number';

alphaNum: 'This field may only contain letters and numbers',
alphaNumDash: 'This field may only contain letters, numbers, and dashes',
alphaNumDash: 'This field may only contain letters, numbers, dashes and underscores',
array: 'This field must be an array',

@@ -144,2 +144,3 @@ between: {

const numericRules = ['numeric'];
const mandatoryRules = ['accepted', 'required'];
function addRule(title, ruleFunction, message) {

@@ -166,2 +167,9 @@ if (!title || !ruleFunction || !message) {

}
function mandatoryRule(rule, value) {
if (mandatoryRules.includes(rule)) {
return true;
}
return value !== undefined;
}
function getRuleValidationFunction(rule) {

@@ -236,7 +244,9 @@ const validationFunction = validationRules[rule];

const ruleValid = await ruleValidationFunction(value, rule.params);
if (mandatoryRule(rule.title, value)) {
const ruleValid = await ruleValidationFunction(value, rule.params);
if (!ruleValid) {
errorMessage = formatErrorMessage(rule, parsedRules);
break;
if (!ruleValid) {
errorMessage = formatErrorMessage(rule, parsedRules);
break;
}
}

@@ -243,0 +253,0 @@ }

{
"name": "handcuffs",
"description": "Async validation library for node and browser",
"version": "0.4.1",
"version": "0.4.2",
"author": "Vlad Shcherbin <vlad.shcherbin@gmail.com>",

@@ -6,0 +6,0 @@ "repository": "VladShcherbin/handcuffs",

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