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

checkit

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

checkit - npm Package Compare versions

Comparing version 0.1.0 to 0.1.3

2

bower.json
{
"name": "checkit",
"version": "0.1.0",
"version": "0.1.3",
"main": "checkit.js",

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

@@ -48,7 +48,8 @@ // CheckIt.js 0.1.0

options || (options = {});
this.target = target;
this._applyAll = [];
this.labels = {};
this.async = _.has(options, 'async') ? options.async : CheckIt.async;
this.language = _.has(options, 'language') ? options.language : CheckIt.language;
this.target = target;
this._applyAll = [];
this.labels = {};
this.labelTransform = options.labelTransform || CheckIt.labelTransform;
this.async = _.has(options, 'async') ? options.async : CheckIt.async;
this.language = _.has(options, 'language') ? options.language : CheckIt.language;
_.bindAll(this, '_asyncError');

@@ -68,3 +69,3 @@ };

applyToAll: function(validator) {
this._applyAll = this._applyAll.concat(validator);
if (validator) this._applyAll = this._applyAll.concat(validator);
return this;

@@ -370,4 +371,4 @@ },

_format: function(key, item) {
var label = item.label || this.checkit.labels[key] || key;
var message = item.message || this.language[item.rule] || this.language.fallback;
var label = item.label || this.checkit.labels[key] || this.language.labels[key] || this.checkit.labelTransform(key);
var message = item.message || this.language.messages[item.rule] || this.language.messages.fallback;
if (message) {

@@ -388,2 +389,7 @@ message = message.replace(labelRegex, label);

// Used to transform the label before using it, can be set globally or in the `options` for the CheckIt object.
CheckIt.labelTransform = function(label) {
return label;
};
// Object containing languages for the validations... Feel free to

@@ -394,38 +400,48 @@ // add anything to this object.

en: {
generic: 'Validation for {{label}} did not pass',
// Custom Predicates
isRequired: 'The {{label}} is required',
isMinLength: 'The {{label}} must be at least {{var_1}} characters long',
isMaxLength: 'The {{label}} must not exceed {{var_1}} characters long',
isExactLength: 'The {{label}} must be exactly {{var_1}} characters long',
isGreaterThan: 'The {{label}} must contain a number greater than {{var_1}}',
isLessThan: 'The {{label}} must contain a number less than {{var_1}}',
validEmail: 'The {{label}} must contain a valid email address',
labels: {},
// Underscore Predicates
isEqual: 'The {{label}} does not match {{var_1}}',
isBoolean: 'The {{label}} must be type "boolean"',
isEmpty: 'The {{label}} must be empty',
isArray: 'The {{label}} must be an array',
messages: {
// Underscore-contrib Predicates
isNumeric: 'The {{label}} must contain only numbers',
isInteger: 'The {{label}} must contain an integer',
isFloat: 'The {{label}} must contain a floating point number',
generic: 'Validation for {{label}} did not pass',
// Regex specific messages.
alpha: 'The {{label}} must only contain alphabetical characters',
alphaDash: 'The {{label}} must only contain alpha-numeric characters, underscores, and dashes',
alphaNumeric: 'The {{label}} must only contain alpha-numeric characters',
alphaUnderscore: 'The {{label}} must only contain alpha-numeric characters, underscores, and dashes',
natural: 'The {{label}} must contain only positive numbers',
naturalNonZero: 'The {{label}} must contain a number greater than zero',
ipv4: 'The {{label}} must contain a valid IPv4 string',
base64: 'The {{label}} must contain a base64 string',
luhn: 'The {{label}} must contain a valid credit card number',
// Custom Predicates
exists: 'The {{label}} must be defined',
required: 'The {{label}} is required',
minLength: 'The {{label}} must be at least {{var_1}} characters long',
maxLength: 'The {{label}} must not exceed {{var_1}} characters long',
exactLength: 'The {{label}} must be exactly {{var_1}} characters long',
greaterThan: 'The {{label}} must contain a number greater than {{var_1}}',
lessThan: 'The {{label}} must contain a number less than {{var_1}}',
validEmail: 'The {{label}} must contain a valid email address',
// If there is no validation provided for an item, use this generic line.
fallback: 'Validation for {{label}} did not pass'
// Underscore Predicates
isEqual: 'The {{label}} does not match {{var_1}}',
isBoolean: 'The {{label}} must be type "boolean"',
isEmpty: 'The {{label}} must be empty',
isArray: 'The {{label}} must be an array',
// Underscore-contrib Predicates
isNumeric: 'The {{label}} must contain only numbers',
isInteger: 'The {{label}} must contain an integer',
isFloat: 'The {{label}} must contain a floating point number',
// Regex specific messages.
alpha: 'The {{label}} must only contain alphabetical characters',
alphaDash: 'The {{label}} must only contain alpha-numeric characters, underscores, and dashes',
alphaNumeric: 'The {{label}} must only contain alpha-numeric characters',
alphaUnderscore: 'The {{label}} must only contain alpha-numeric characters, underscores, and dashes',
natural: 'The {{label}} must contain only positive numbers',
naturalNonZero: 'The {{label}} must contain a number greater than zero',
ipv4: 'The {{label}} must contain a valid IPv4 string',
base64: 'The {{label}} must contain a base64 string',
luhn: 'The {{label}} must contain a valid credit card number',
// If there is no validation provided for an item, use this generic line.
fallback: 'Validation for {{label}} did not pass'
}
}
};

@@ -432,0 +448,0 @@

@@ -836,6 +836,9 @@ /** @license MIT License (c) copyright 2011-2013 original author or authors */

typeof define === 'function' && define.amd ? define : function (factory) {
var target = (typeof exports === 'object' ? module.exports : this['when']);
target = factory();
if (typeof exports === 'object') {
module.exports = factory();
} else {
this['when'] = factory();
}
},
this
);
{
"name": "checkit",
"version": "0.1.0",
"version": "0.1.3",
"description": "Simple validations for node and the browser.",

@@ -5,0 +5,0 @@ "main": "checkit.js",

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