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

@silviejs/validator

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@silviejs/validator - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

11

helpers/checkExistence.js

@@ -1,8 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = value => {
export default (value => {
if (value !== null && value !== undefined) {

@@ -15,3 +9,2 @@ if (typeof value === 'string') {

return false;
};
exports.default = _default;
});

22

index.js

@@ -1,12 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("./rule");
var _messages = _interopRequireDefault(require("./messages"));
require("./rules");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class Validator {
import { validationRules } from './rule';
import validationMessages from './messages';
import './rules';
export default class Validator {
hasErrors = false;

@@ -76,3 +69,3 @@ generateNestedErrors = true;

// Get rule
const rule = _rule.validationRules[name];
const rule = validationRules[name];

@@ -129,3 +122,3 @@ // If there is no rule throw an error

// Find raw error message
const rawMessage = rule.messenger && rule.messenger(validationResult) || this.messages[`${exactPath}:${rule.name}`] || this.messages[`${fieldName}:${rule.name}`] || _messages.default[rule.name];
const rawMessage = rule.messenger && rule.messenger(validationResult) || this.messages[`${exactPath}:${rule.name}`] || this.messages[`${fieldName}:${rule.name}`] || validationMessages[rule.name];
if (rawMessage) {

@@ -200,3 +193,2 @@ const rawMessages = [];

}
}
exports.default = Validator;
}

@@ -1,8 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = exports.default = {
export default {
array: ':path is not an array',

@@ -9,0 +3,0 @@ contains: ':path does not contain :0',

{
"name": "@silviejs/validator",
"version": "1.0.0",
"version": "1.0.1",
"description": "Silvie JS Validator",
"typings": "bootstrap/index.d.ts",
"main": "index.js",
"type": "module",
"keywords": [

@@ -8,0 +9,0 @@ "validator",

@@ -1,10 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.rule = rule;
exports.validationRules = void 0;
const validationRules = exports.validationRules = {};
function rule(name) {
export const validationRules = {};
export function rule(name) {
return Class => {

@@ -11,0 +4,0 @@ validationRules[name] = {

@@ -1,77 +0,75 @@

"use strict";
require("./rules/after");
require("./rules/alphanumeric");
require("./rules/alpha");
require("./rules/array");
require("./rules/ascii");
require("./rules/base32");
require("./rules/base64");
require("./rules/before");
require("./rules/boolean");
require("./rules/confirmed");
require("./rules/contains");
require("./rules/credit_card");
require("./rules/data_uri");
require("./rules/date");
require("./rules/decimal");
require("./rules/distinct");
require("./rules/divisible_by");
require("./rules/email");
require("./rules/empty");
require("./rules/ends_with");
require("./rules/equals");
require("./rules/float");
require("./rules/fqdn");
require("./rules/full_width");
require("./rules/half_width");
require("./rules/hash");
require("./rules/hex_color");
require("./rules/hex");
require("./rules/identity_card");
require("./rules/in");
require("./rules/int");
require("./rules/ip_range");
require("./rules/ip");
require("./rules/isbn");
require("./rules/isin");
require("./rules/iso_31661_alpha_2");
require("./rules/iso_31661_alpha_3");
require("./rules/iso_8601");
require("./rules/isrc");
require("./rules/issn");
require("./rules/json");
require("./rules/jwt");
require("./rules/lat_long");
require("./rules/length");
require("./rules/lowercase");
require("./rules/mac");
require("./rules/magnet_uri");
require("./rules/max");
require("./rules/md5");
require("./rules/mime");
require("./rules/min");
require("./rules/mobile");
require("./rules/mongo_id");
require("./rules/multibyte");
require("./rules/name");
require("./rules/not_in");
require("./rules/nullable");
require("./rules/numeric");
require("./rules/octal");
require("./rules/port");
require("./rules/postal_code");
require("./rules/present");
require("./rules/requiredIf");
require("./rules/required");
require("./rules/requiredUnless");
require("./rules/requiredWithout");
require("./rules/requiredWith");
require("./rules/rfc_3339");
require("./rules/size");
require("./rules/starts_with");
require("./rules/surrogate_pairs");
require("./rules/uppercase");
require("./rules/url");
require("./rules/uuid");
require("./rules/variable_width");
import './rules/after';
import './rules/alphanumeric';
import './rules/alpha';
import './rules/array';
import './rules/ascii';
import './rules/base32';
import './rules/base64';
import './rules/before';
import './rules/boolean';
import './rules/confirmed';
import './rules/contains';
import './rules/credit_card';
import './rules/data_uri';
import './rules/date';
import './rules/decimal';
import './rules/distinct';
import './rules/divisible_by';
import './rules/email';
import './rules/empty';
import './rules/ends_with';
import './rules/equals';
import './rules/float';
import './rules/fqdn';
import './rules/full_width';
import './rules/half_width';
import './rules/hash';
import './rules/hex_color';
import './rules/hex';
import './rules/identity_card';
import './rules/in';
import './rules/int';
import './rules/ip_range';
import './rules/ip';
import './rules/isbn';
import './rules/isin';
import './rules/iso_31661_alpha_2';
import './rules/iso_31661_alpha_3';
import './rules/iso_8601';
import './rules/isrc';
import './rules/issn';
import './rules/json';
import './rules/jwt';
import './rules/lat_long';
import './rules/length';
import './rules/lowercase';
import './rules/mac';
import './rules/magnet_uri';
import './rules/max';
import './rules/md5';
import './rules/mime';
import './rules/min';
import './rules/mobile';
import './rules/mongo_id';
import './rules/multibyte';
import './rules/name';
import './rules/not_in';
import './rules/nullable';
import './rules/numeric';
import './rules/octal';
import './rules/port';
import './rules/postal_code';
import './rules/present';
import './rules/requiredIf';
import './rules/required';
import './rules/requiredUnless';
import './rules/requiredWithout';
import './rules/requiredWith';
import './rules/rfc_3339';
import './rules/size';
import './rules/starts_with';
import './rules/surrogate_pairs';
import './rules/uppercase';
import './rules/url';
import './rules/uuid';
import './rules/variable_width';

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let AfterRule = exports.default = (_dec = (0, _rule.rule)('after'), _dec(_class = class AfterRule {
import { rule } from '../rule';
import { after } from 'validator';
let AfterRule = (_dec = rule('after'), _dec(_class = class AfterRule {
validate(validator, name, value, key) {
return (0, _validator.after)(value, key);
return after(value, key);
}
}) || _class);
}) || _class);
export { AfterRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let AlphaRule = exports.default = (_dec = (0, _rule.rule)('alpha'), _dec(_class = class AlphaRule {
import { rule } from '../rule';
import { isAlpha } from 'validator';
let AlphaRule = (_dec = rule('alpha'), _dec(_class = class AlphaRule {
validate(validator, name, value) {
return (0, _validator.isAlpha)(value);
return isAlpha(value);
}
}) || _class);
}) || _class);
export { AlphaRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let AlphaNumericRule = exports.default = (_dec = (0, _rule.rule)('alphanumeric'), _dec(_class = class AlphaNumericRule {
import { rule } from '../rule';
import { isAlphanumeric } from 'validator';
let AlphaNumericRule = (_dec = rule('alphanumeric'), _dec(_class = class AlphaNumericRule {
validate(validator, name, value) {
return (0, _validator.isAlphanumeric)(value);
return isAlphanumeric(value);
}
}) || _class);
}) || _class);
export { AlphaNumericRule as default };

@@ -1,13 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let ArrayRule = exports.default = (_dec = (0, _rule.rule)('array'), _dec(_class = class ArrayRule {
import { rule } from '../rule';
let ArrayRule = (_dec = rule('array'), _dec(_class = class ArrayRule {
validate(validator, name, value) {
return value instanceof Array;
}
}) || _class);
}) || _class);
export { ArrayRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let ASCIIRule = exports.default = (_dec = (0, _rule.rule)('ascii'), _dec(_class = class ASCIIRule {
import { rule } from '../rule';
import { isAscii } from 'validator';
let ASCIIRule = (_dec = rule('ascii'), _dec(_class = class ASCIIRule {
validate(validator, name, value) {
return (0, _validator.isAscii)(value);
return isAscii(value);
}
}) || _class);
}) || _class);
export { ASCIIRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let Base32Rule = exports.default = (_dec = (0, _rule.rule)('base32'), _dec(_class = class Base32Rule {
import { rule } from '../rule';
import { isBase32 } from 'validator';
let Base32Rule = (_dec = rule('base32'), _dec(_class = class Base32Rule {
validate(validator, name, value) {
return (0, _validator.isBase32)(value);
return isBase32(value);
}
}) || _class);
}) || _class);
export { Base32Rule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let Base64Rule = exports.default = (_dec = (0, _rule.rule)('base64'), _dec(_class = class Base64Rule {
import { rule } from '../rule';
import { isBase64 } from 'validator';
let Base64Rule = (_dec = rule('base64'), _dec(_class = class Base64Rule {
validate(validator, name, value) {
return (0, _validator.isBase64)(value);
return isBase64(value);
}
}) || _class);
}) || _class);
export { Base64Rule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let BeforeRule = exports.default = (_dec = (0, _rule.rule)('before'), _dec(_class = class BeforeRule {
import { rule } from '../rule';
import { before } from 'validator';
let BeforeRule = (_dec = rule('before'), _dec(_class = class BeforeRule {
validate(validator, name, value, key) {
return (0, _validator.before)(value, key);
return before(value, key);
}
}) || _class);
}) || _class);
export { BeforeRule as default };

@@ -1,10 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let BooleanRule = exports.default = (_dec = (0, _rule.rule)('boolean'), _dec(_class = class BooleanRule {
import { rule } from '../rule';
let BooleanRule = (_dec = rule('boolean'), _dec(_class = class BooleanRule {
validate(validator, name, value) {

@@ -19,2 +13,3 @@ if (typeof value === 'boolean') {

}
}) || _class);
}) || _class);
export { BooleanRule as default };

@@ -1,19 +0,12 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _index = _interopRequireDefault(require("../index"));
var _checkExistence = _interopRequireDefault(require("../helpers/checkExistence"));
var _dec, _class;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let ConfirmedRule = exports.default = (_dec = (0, _rule.rule)('confirmed'), _dec(_class = class ConfirmedRule {
import { rule } from '../rule';
import Validator from '../index';
import checkExistence from '../helpers/checkExistence';
let ConfirmedRule = (_dec = rule('confirmed'), _dec(_class = class ConfirmedRule {
validate(validator, name, value, confirmationName) {
let results;
if (confirmationName) {
results = _index.default.findData(validator.data, confirmationName.split('.'));
results = Validator.findData(validator.data, confirmationName.split('.'));
} else {
results = _index.default.findData(validator.data, `${name}Confirmation`.split('.'));
results = Validator.findData(validator.data, `${name}Confirmation`.split('.'));
}

@@ -26,4 +19,5 @@ if (results.length === 0) {

}] = results;
return (0, _checkExistence.default)(confirmedValue) && confirmedValue === value;
return checkExistence(confirmedValue) && confirmedValue === value;
}
}) || _class);
}) || _class);
export { ConfirmedRule as default };

@@ -1,13 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let ContainsRule = exports.default = (_dec = (0, _rule.rule)('contains'), _dec(_class = class ContainsRule {
import { rule } from '../rule';
let ContainsRule = (_dec = rule('contains'), _dec(_class = class ContainsRule {
validate(validator, name, value, key) {
return value.includes(key);
}
}) || _class);
}) || _class);
export { ContainsRule as default };

@@ -1,11 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let CreditCardRule = exports.default = (_dec = (0, _rule.rule)('creditCard'), _dec(_class = class CreditCardRule {
import { rule } from '../rule';
import { isCreditCard } from 'validator';
let CreditCardRule = (_dec = rule('creditCard'), _dec(_class = class CreditCardRule {
validate(validator, name, value, locale) {

@@ -15,4 +9,5 @@ if (locale === 'fa-IR') {

}
return (0, _validator.isCreditCard)(value);
return isCreditCard(value);
}
}) || _class);
}) || _class);
export { CreditCardRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let DataURIRule = exports.default = (_dec = (0, _rule.rule)('dataUri'), _dec(_class = class DataURIRule {
import { rule } from '../rule';
import { isDataURI } from 'validator';
let DataURIRule = (_dec = rule('dataUri'), _dec(_class = class DataURIRule {
validate(validator, name, value) {
return (0, _validator.isDataURI)(value);
return isDataURI(value);
}
}) || _class);
}) || _class);
export { DataURIRule as default };

@@ -1,16 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let DateRule = exports.default = (_dec = (0, _rule.rule)('date'), _dec(_class = class DateRule {
import { rule } from '../rule';
import { isDate } from 'validator';
let DateRule = (_dec = rule('date'), _dec(_class = class DateRule {
validate(validator, name, value, format) {
return (0, _validator.isDate)(value, {
return isDate(value, {
format
});
}
}) || _class);
}) || _class);
export { DateRule as default };

@@ -1,16 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let DecimalRule = exports.default = (_dec = (0, _rule.rule)('decimal'), _dec(_class = class DecimalRule {
import { rule } from '../rule';
import { isDecimal } from 'validator';
let DecimalRule = (_dec = rule('decimal'), _dec(_class = class DecimalRule {
validate(validator, name, value, locale = 'en-US') {
return (0, _validator.isDecimal)(`${value}`, {
return isDecimal(`${value}`, {
locale
});
}
}) || _class);
}) || _class);
export { DecimalRule as default };

@@ -1,10 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let DistinctRule = exports.default = (_dec = (0, _rule.rule)('distinct'), _dec(_class = class DistinctRule {
import { rule } from '../rule';
let DistinctRule = (_dec = rule('distinct'), _dec(_class = class DistinctRule {
validate(validator, name, value) {

@@ -16,2 +10,3 @@ if (value instanceof Array) {

}
}) || _class);
}) || _class);
export { DistinctRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let DivisibleByRule = exports.default = (_dec = (0, _rule.rule)('divisibleBy'), _dec(_class = class DivisibleByRule {
import { rule } from '../rule';
import { isDivisibleBy } from 'validator';
let DivisibleByRule = (_dec = rule('divisibleBy'), _dec(_class = class DivisibleByRule {
validate(validator, name, value, divider) {
return (0, _validator.isDivisibleBy)(value, divider);
return isDivisibleBy(value, divider);
}
}) || _class);
}) || _class);
export { DivisibleByRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let EmailRule = exports.default = (_dec = (0, _rule.rule)('email'), _dec(_class = class EmailRule {
import { rule } from '../rule';
import { isEmail } from 'validator';
let EmailRule = (_dec = rule('email'), _dec(_class = class EmailRule {
validate(validator, name, value) {
return (0, _validator.isEmail)(value);
return isEmail(value);
}
}) || _class);
}) || _class);
export { EmailRule as default };

@@ -1,13 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let EmptyRule = exports.default = (_dec = (0, _rule.rule)('empty'), _dec(_class = class EmptyRule {
import { rule } from '../rule';
let EmptyRule = (_dec = rule('empty'), _dec(_class = class EmptyRule {
validate(validator, name, value, trim = 'true') {
return (trim && ['yes', 'true', '1'].includes(trim) ? `${value}`.trim() : `${value}`).length === 0;
}
}) || _class);
}) || _class);
export { EmptyRule as default };

@@ -1,10 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let EndsWithRule = exports.default = (_dec = (0, _rule.rule)('endsWith'), _dec(_class = class EndsWithRule {
import { rule } from '../rule';
let EndsWithRule = (_dec = rule('endsWith'), _dec(_class = class EndsWithRule {
validate(validator, name, value, key) {

@@ -16,2 +10,3 @@ if (typeof value === 'string') {

}
}) || _class);
}) || _class);
export { EndsWithRule as default };

@@ -1,10 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let EqualsRule = exports.default = (_dec = (0, _rule.rule)('equals'), _dec(_class = class EqualsRule {
import { rule } from '../rule';
let EqualsRule = (_dec = rule('equals'), _dec(_class = class EqualsRule {
validate(validator, name, value, key) {

@@ -30,2 +24,3 @@ if (typeof value === 'object') {

}
}) || _class);
}) || _class);
export { EqualsRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let FloatRule = exports.default = (_dec = (0, _rule.rule)('float'), _dec(_class = class FloatRule {
import { rule } from '../rule';
import { isFloat } from 'validator';
let FloatRule = (_dec = rule('float'), _dec(_class = class FloatRule {
validate(validator, name, value) {
return (0, _validator.isFloat)(`${value}`);
return isFloat(`${value}`);
}
}) || _class);
}) || _class);
export { FloatRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let FQDNRule = exports.default = (_dec = (0, _rule.rule)('fqdn'), _dec(_class = class FQDNRule {
import { rule } from '../rule';
import { isFQDN } from 'validator';
let FQDNRule = (_dec = rule('fqdn'), _dec(_class = class FQDNRule {
validate(validator, name, value) {
return (0, _validator.isFQDN)(value);
return isFQDN(value);
}
}) || _class);
}) || _class);
export { FQDNRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let FullWidthRule = exports.default = (_dec = (0, _rule.rule)('fullWidth'), _dec(_class = class FullWidthRule {
import { rule } from '../rule';
import { isFullWidth } from 'validator';
let FullWidthRule = (_dec = rule('fullWidth'), _dec(_class = class FullWidthRule {
validate(validator, name, value) {
return (0, _validator.isFullWidth)(value);
return isFullWidth(value);
}
}) || _class);
}) || _class);
export { FullWidthRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let HalfWidthRule = exports.default = (_dec = (0, _rule.rule)('halfWidth'), _dec(_class = class HalfWidthRule {
import { rule } from '../rule';
import { isHalfWidth } from 'validator';
let HalfWidthRule = (_dec = rule('halfWidth'), _dec(_class = class HalfWidthRule {
validate(validator, name, value) {
return (0, _validator.isHalfWidth)(value);
return isHalfWidth(value);
}
}) || _class);
}) || _class);
export { HalfWidthRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let HashRule = exports.default = (_dec = (0, _rule.rule)('hash'), _dec(_class = class HashRule {
import { rule } from '../rule';
import { isHash } from 'validator';
let HashRule = (_dec = rule('hash'), _dec(_class = class HashRule {
validate(validator, name, value, algorithm) {
return (0, _validator.isHash)(value, algorithm);
return isHash(value, algorithm);
}
}) || _class);
}) || _class);
export { HashRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let HexColorRule = exports.default = (_dec = (0, _rule.rule)('hexColor'), _dec(_class = class HexColorRule {
import { rule } from '../rule';
import { isHexColor } from 'validator';
let HexColorRule = (_dec = rule('hexColor'), _dec(_class = class HexColorRule {
validate(validator, name, value) {
return (0, _validator.isHexColor)(value);
return isHexColor(value);
}
}) || _class);
}) || _class);
export { HexColorRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let HexadecimalRule = exports.default = (_dec = (0, _rule.rule)('hex'), _dec(_class = class HexadecimalRule {
import { rule } from '../rule';
import { isHexadecimal } from 'validator';
let HexadecimalRule = (_dec = rule('hex'), _dec(_class = class HexadecimalRule {
validate(validator, name, value) {
return (0, _validator.isHexadecimal)(value);
return isHexadecimal(value);
}
}) || _class);
}) || _class);
export { HexadecimalRule as default };

@@ -1,11 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let IdentityCardRule = exports.default = (_dec = (0, _rule.rule)('identityCard'), _dec(_class = class IdentityCardRule {
import { rule } from '../rule';
import { isIdentityCard } from 'validator';
let IdentityCardRule = (_dec = rule('identityCard'), _dec(_class = class IdentityCardRule {
validate(validator, name, value, locale) {

@@ -23,4 +17,5 @@ if (locale === 'fa_IR') {

}
return (0, _validator.isIdentityCard)(value, locale);
return isIdentityCard(value, locale);
}
}) || _class);
}) || _class);
export { IdentityCardRule as default };

@@ -1,13 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let InRule = exports.default = (_dec = (0, _rule.rule)('in'), _dec(_class = class InRule {
import { rule } from '../rule';
let InRule = (_dec = rule('in'), _dec(_class = class InRule {
validate(validator, name, value, ...keys) {
return keys.includes(`${value}`);
}
}) || _class);
}) || _class);
export { InRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let IntRule = exports.default = (_dec = (0, _rule.rule)('int'), _dec(_class = class IntRule {
import { rule } from '../rule';
import { isInt } from 'validator';
let IntRule = (_dec = rule('int'), _dec(_class = class IntRule {
validate(validator, name, value) {
return typeof value === 'number' || typeof value === 'string' && (0, _validator.isInt)(`${value}`);
return typeof value === 'number' || typeof value === 'string' && isInt(`${value}`);
}
}) || _class);
}) || _class);
export { IntRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let IPRangeRule = exports.default = (_dec = (0, _rule.rule)('ipRange'), _dec(_class = class IPRangeRule {
import { rule } from '../rule';
import { isIPRange } from 'validator';
let IPRangeRule = (_dec = rule('ipRange'), _dec(_class = class IPRangeRule {
validate(validator, name, value) {
return (0, _validator.isIPRange)(value);
return isIPRange(value);
}
}) || _class);
}) || _class);
export { IPRangeRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let IPRule = exports.default = (_dec = (0, _rule.rule)('ip'), _dec(_class = class IPRule {
import { rule } from '../rule';
import { isIP } from 'validator';
let IPRule = (_dec = rule('ip'), _dec(_class = class IPRule {
validate(validator, name, value, version = '4') {
return (0, _validator.isIP)(value, version);
return isIP(value, version);
}
}) || _class);
}) || _class);
export { IPRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let ISBNRule = exports.default = (_dec = (0, _rule.rule)('isbn'), _dec(_class = class ISBNRule {
import { rule } from '../rule';
import { isISBN } from 'validator';
let ISBNRule = (_dec = rule('isbn'), _dec(_class = class ISBNRule {
validate(validator, name, value, version = '10') {
return (0, _validator.isISBN)(value, version);
return isISBN(value, version);
}
}) || _class);
}) || _class);
export { ISBNRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let ISINRule = exports.default = (_dec = (0, _rule.rule)('isin'), _dec(_class = class ISINRule {
import { rule } from '../rule';
import { isISIN } from 'validator';
let ISINRule = (_dec = rule('isin'), _dec(_class = class ISINRule {
validate(validator, name, value) {
return (0, _validator.isISIN)(value);
return isISIN(value);
}
}) || _class);
}) || _class);
export { ISINRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let ISO31661Alpha2Rule = exports.default = (_dec = (0, _rule.rule)('iso31661Alpha2'), _dec(_class = class ISO31661Alpha2Rule {
import { rule } from '../rule';
import { isISO31661Alpha2 } from 'validator';
let ISO31661Alpha2Rule = (_dec = rule('iso31661Alpha2'), _dec(_class = class ISO31661Alpha2Rule {
validate(validator, name, value) {
return (0, _validator.isISO31661Alpha2)(value);
return isISO31661Alpha2(value);
}
}) || _class);
}) || _class);
export { ISO31661Alpha2Rule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let ISO31661Alpha3Rule = exports.default = (_dec = (0, _rule.rule)('iso31661Alpha3'), _dec(_class = class ISO31661Alpha3Rule {
import { rule } from '../rule';
import { isISO31661Alpha3 } from 'validator';
let ISO31661Alpha3Rule = (_dec = rule('iso31661Alpha3'), _dec(_class = class ISO31661Alpha3Rule {
validate(validator, name, value) {
return (0, _validator.isISO31661Alpha3)(value);
return isISO31661Alpha3(value);
}
}) || _class);
}) || _class);
export { ISO31661Alpha3Rule as default };

@@ -1,16 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let ISO8601Rule = exports.default = (_dec = (0, _rule.rule)('iso8601'), _dec(_class = class ISO8601Rule {
import { rule } from '../rule';
import { isISO8601 } from 'validator';
let ISO8601Rule = (_dec = rule('iso8601'), _dec(_class = class ISO8601Rule {
validate(validator, name, value, isStrict = 'true') {
return (0, _validator.isISO8601)(value, {
return isISO8601(value, {
strict: isStrict && ['yes', 'true', '1'].includes(isStrict)
});
}
}) || _class);
}) || _class);
export { ISO8601Rule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let ISRCRule = exports.default = (_dec = (0, _rule.rule)('isrc'), _dec(_class = class ISRCRule {
import { rule } from '../rule';
import { isISRC } from 'validator';
let ISRCRule = (_dec = rule('isrc'), _dec(_class = class ISRCRule {
validate(validator, name, value) {
return (0, _validator.isISRC)(value);
return isISRC(value);
}
}) || _class);
}) || _class);
export { ISRCRule as default };

@@ -1,13 +0,7 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let ISSNRule = exports.default = (_dec = (0, _rule.rule)('issn'), _dec(_class = class ISSNRule {
import { rule } from '../rule';
import { isISSN } from 'validator';
let ISSNRule = (_dec = rule('issn'), _dec(_class = class ISSNRule {
validate(validator, name, value, caseSensitive = 'false', requireHyphen = 'false') {
return (0, _validator.isISSN)(value, {
return isISSN(value, {
case_sensitive: caseSensitive && ['yes', 'true', '1'].includes(caseSensitive),

@@ -17,2 +11,3 @@ require_hyphen: requireHyphen && ['yes', 'true', '1'].includes(requireHyphen)

}
}) || _class);
}) || _class);
export { ISSNRule as default };

@@ -1,16 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let JSONRule = exports.default = (_dec = (0, _rule.rule)('json'), _dec(_class = class JSONRule {
import { rule } from '../rule';
import { isJSON } from 'validator';
let JSONRule = (_dec = rule('json'), _dec(_class = class JSONRule {
validate(validator, name, value, allowPrimitives = 'false') {
return (0, _validator.isJSON)(value, {
return isJSON(value, {
allow_primitives: allowPrimitives && ['yes', 'true', '1'].includes(allowPrimitives)
});
}
}) || _class);
}) || _class);
export { JSONRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let JWTRule = exports.default = (_dec = (0, _rule.rule)('jwt'), _dec(_class = class JWTRule {
import { rule } from '../rule';
import { isJWT } from 'validator';
let JWTRule = (_dec = rule('jwt'), _dec(_class = class JWTRule {
validate(validator, name, value) {
return (0, _validator.isJWT)(value);
return isJWT(value);
}
}) || _class);
}) || _class);
export { JWTRule as default };

@@ -1,16 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let LatLngRule = exports.default = (_dec = (0, _rule.rule)('latlng'), _dec(_class = class LatLngRule {
import { rule } from '../rule';
import { isLatLong } from 'validator';
let LatLngRule = (_dec = rule('latlng'), _dec(_class = class LatLngRule {
validate(validator, name, value, checkDMS = 'false') {
return (0, _validator.isLatLong)(value, {
return isLatLong(value, {
checkDMS: checkDMS && ['yes', 'true', '1'].includes(checkDMS)
});
}
}) || _class);
}) || _class);
export { LatLngRule as default };

@@ -1,10 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let LengthRule = exports.default = (_dec = (0, _rule.rule)('length'), _dec(_class = class LengthRule {
import { rule } from '../rule';
let LengthRule = (_dec = rule('length'), _dec(_class = class LengthRule {
validate(validator, name, value, length) {

@@ -16,2 +10,3 @@ if (value instanceof Array || typeof value === 'string') {

}
}) || _class);
}) || _class);
export { LengthRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let LowercaseRule = exports.default = (_dec = (0, _rule.rule)('lowercase'), _dec(_class = class LowercaseRule {
import { rule } from '../rule';
import { isLowercase } from 'validator';
let LowercaseRule = (_dec = rule('lowercase'), _dec(_class = class LowercaseRule {
validate(validator, name, value) {
return (0, _validator.isLowercase)(value);
return isLowercase(value);
}
}) || _class);
}) || _class);
export { LowercaseRule as default };

@@ -1,16 +0,11 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let MACAddressRule = exports.default = (_dec = (0, _rule.rule)('mac'), _dec(_class = class MACAddressRule {
import { rule } from '../rule';
import { isMACAddress } from 'validator';
let MACAddressRule = (_dec = rule('mac'), _dec(_class = class MACAddressRule {
validate(validator, name, value, noColons = 'false') {
return (0, _validator.isMACAddress)(value, {
return isMACAddress(value, {
no_colons: noColons && ['yes', 'true', '1'].includes(noColons)
});
}
}) || _class);
}) || _class);
export { MACAddressRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let MagnetURIRule = exports.default = (_dec = (0, _rule.rule)('magnetUri'), _dec(_class = class MagnetURIRule {
import { rule } from '../rule';
import { isMagnetURI } from 'validator';
let MagnetURIRule = (_dec = rule('magnetUri'), _dec(_class = class MagnetURIRule {
validate(validator, name, value) {
return (0, _validator.isMagnetURI)(value);
return isMagnetURI(value);
}
}) || _class);
}) || _class);
export { MagnetURIRule as default };

@@ -1,11 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let MaxRule = exports.default = (_dec = (0, _rule.rule)('max'), _dec(_class = class MaxRule {
import { rule } from '../rule';
import { isNumeric } from 'validator';
let MaxRule = (_dec = rule('max'), _dec(_class = class MaxRule {
validate(validator, name, value, maxValue) {

@@ -16,3 +10,3 @@ const max = Number(maxValue);

}
if (typeof value === 'number' || (0, _validator.isNumeric)(`${value}`)) {
if (typeof value === 'number' || isNumeric(`${value}`)) {
return value <= max;

@@ -22,2 +16,3 @@ }

}
}) || _class);
}) || _class);
export { MaxRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let MD5Rule = exports.default = (_dec = (0, _rule.rule)('md5'), _dec(_class = class MD5Rule {
import { rule } from '../rule';
import { isMD5 } from 'validator';
let MD5Rule = (_dec = rule('md5'), _dec(_class = class MD5Rule {
validate(validator, name, value) {
return (0, _validator.isMD5)(value);
return isMD5(value);
}
}) || _class);
}) || _class);
export { MD5Rule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let MimeTypeRule = exports.default = (_dec = (0, _rule.rule)('mime'), _dec(_class = class MimeTypeRule {
import { rule } from '../rule';
import { isMimeType } from 'validator';
let MimeTypeRule = (_dec = rule('mime'), _dec(_class = class MimeTypeRule {
validate(validator, name, value) {
return (0, _validator.isMimeType)(value);
return isMimeType(value);
}
}) || _class);
}) || _class);
export { MimeTypeRule as default };

@@ -1,11 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let MinRule = exports.default = (_dec = (0, _rule.rule)('min'), _dec(_class = class MinRule {
import { rule } from '../rule';
import { isNumeric } from 'validator';
let MinRule = (_dec = rule('min'), _dec(_class = class MinRule {
validate(validator, name, value, minValue) {

@@ -16,3 +10,3 @@ const min = Number(minValue);

}
if (typeof value === 'number' || (0, _validator.isNumeric)(`${value}`)) {
if (typeof value === 'number' || isNumeric(`${value}`)) {
return value >= min;

@@ -22,2 +16,3 @@ }

}
}) || _class);
}) || _class);
export { MinRule as default };

@@ -1,11 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let MobileRule = exports.default = (_dec = (0, _rule.rule)('mobile'), _dec(_class = class MobileRule {
import { rule } from '../rule';
import { isMobilePhone } from 'validator';
let MobileRule = (_dec = rule('mobile'), _dec(_class = class MobileRule {
validate(validator, name, value, locale) {

@@ -15,4 +9,5 @@ if (locale === 'fa-IR') {

}
return (0, _validator.isMobilePhone)(value, locale);
return isMobilePhone(value, locale);
}
}) || _class);
}) || _class);
export { MobileRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let MongoIdRule = exports.default = (_dec = (0, _rule.rule)('mongoId'), _dec(_class = class MongoIdRule {
import { rule } from '../rule';
import { isMongoId } from 'validator';
let MongoIdRule = (_dec = rule('mongoId'), _dec(_class = class MongoIdRule {
validate(validator, name, value) {
return (0, _validator.isMongoId)(value);
return isMongoId(value);
}
}) || _class);
}) || _class);
export { MongoIdRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let MultibyteRule = exports.default = (_dec = (0, _rule.rule)('multibyte'), _dec(_class = class MultibyteRule {
import { rule } from '../rule';
import { isMultibyte } from 'validator';
let MultibyteRule = (_dec = rule('multibyte'), _dec(_class = class MultibyteRule {
validate(validator, name, value) {
return (0, _validator.isMultibyte)(value);
return isMultibyte(value);
}
}) || _class);
}) || _class);
export { MultibyteRule as default };

@@ -1,13 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let NameRule = exports.default = (_dec = (0, _rule.rule)('name'), _dec(_class = class NameRule {
import { rule } from '../rule';
let NameRule = (_dec = rule('name'), _dec(_class = class NameRule {
validate(validator, name, value) {
return /^[^0-9\\/'"[\]{}()_\-=+*&^%$#@!~`,.<>?:;]+$/.test(value);
}
}) || _class);
}) || _class);
export { NameRule as default };

@@ -1,13 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let InRule = exports.default = (_dec = (0, _rule.rule)('notIn'), _dec(_class = class InRule {
import { rule } from '../rule';
let InRule = (_dec = rule('notIn'), _dec(_class = class InRule {
validate(validator, name, value, ...keys) {
return !keys.includes(`${value}`);
}
}) || _class);
}) || _class);
export { InRule as default };

@@ -1,10 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let NullableRule = exports.default = (_dec = (0, _rule.rule)('nullable'), _dec(_class = class NullableRule {
import { rule } from '../rule';
let NullableRule = (_dec = rule('nullable'), _dec(_class = class NullableRule {
validate(validator, name, value) {

@@ -22,2 +16,3 @@ if (value !== null && value !== undefined) {

}
}) || _class);
}) || _class);
export { NullableRule as default };

@@ -1,13 +0,7 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let NumericRule = exports.default = (_dec = (0, _rule.rule)('numeric'), _dec(_class = class NumericRule {
import { rule } from '../rule';
import { isNumeric } from 'validator';
let NumericRule = (_dec = rule('numeric'), _dec(_class = class NumericRule {
validate(validator, name, value, locale, noSymbols = 'false') {
return typeof value === 'number' || (0, _validator.isNumeric)(value, {
return typeof value === 'number' || isNumeric(value, {
locale,

@@ -17,2 +11,3 @@ no_symbols: noSymbols && ['yes', 'true', '1'].includes(noSymbols)

}
}) || _class);
}) || _class);
export { NumericRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let OctalRule = exports.default = (_dec = (0, _rule.rule)('octal'), _dec(_class = class OctalRule {
import { rule } from '../rule';
import { isOctal } from 'validator';
let OctalRule = (_dec = rule('octal'), _dec(_class = class OctalRule {
validate(validator, name, value) {
return (0, _validator.isOctal)(value);
return isOctal(value);
}
}) || _class);
}) || _class);
export { OctalRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let PortRule = exports.default = (_dec = (0, _rule.rule)('port'), _dec(_class = class PortRule {
import { rule } from '../rule';
import { isPort } from 'validator';
let PortRule = (_dec = rule('port'), _dec(_class = class PortRule {
validate(validator, name, value) {
return (0, _validator.isPort)(value);
return isPort(value);
}
}) || _class);
}) || _class);
export { PortRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let PostalCodeRule = exports.default = (_dec = (0, _rule.rule)('postalCode'), _dec(_class = class PostalCodeRule {
import { rule } from '../rule';
import { isPostalCode } from 'validator';
let PostalCodeRule = (_dec = rule('postalCode'), _dec(_class = class PostalCodeRule {
validate(validator, name, value, locale) {
return (0, _validator.isPostalCode)(value, locale);
return isPostalCode(value, locale);
}
}) || _class);
}) || _class);
export { PostalCodeRule as default };

@@ -1,13 +0,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let PresentRule = exports.default = (_dec = (0, _rule.rule)('present'), _dec(_class = class PresentRule {
import { rule } from '../rule';
let PresentRule = (_dec = rule('present'), _dec(_class = class PresentRule {
validate(validator, name, value) {
return value !== undefined || null;
}
}) || _class);
}) || _class);
export { PresentRule as default };

@@ -1,15 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _checkExistence = _interopRequireDefault(require("../helpers/checkExistence"));
var _dec, _class;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let RequiredRule = exports.default = (_dec = (0, _rule.rule)('required'), _dec(_class = class RequiredRule {
import { rule } from '../rule';
import checkExistence from '../helpers/checkExistence';
let RequiredRule = (_dec = rule('required'), _dec(_class = class RequiredRule {
validate(validator, name, value) {
return (0, _checkExistence.default)(value) || null;
return checkExistence(value) || null;
}
}) || _class);
}) || _class);
export { RequiredRule as default };

@@ -1,17 +0,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _index = _interopRequireDefault(require("../index"));
var _checkExistence = _interopRequireDefault(require("../helpers/checkExistence"));
var _dec, _class;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let RequiredIfRule = exports.default = (_dec = (0, _rule.rule)('requiredIf'), _dec(_class = class RequiredIfRule {
import { rule } from '../rule';
import Validator from '../index';
import checkExistence from '../helpers/checkExistence';
let RequiredIfRule = (_dec = rule('requiredIf'), _dec(_class = class RequiredIfRule {
validate(validator, name, value, path, key) {
const results = _index.default.findData(validator.data, path.split('.'));
const results = Validator.findData(validator.data, path.split('.'));
if (results.length === 0) {
return (0, _checkExistence.default)(value) || undefined;
return checkExistence(value) || undefined;
}

@@ -23,7 +16,8 @@ for (let index = 0; index < results.length; index++) {

if ((typeof matchingValue === 'string' ? matchingValue : JSON.stringify(matchingValue)) !== key) {
return (0, _checkExistence.default)(value) || undefined;
return checkExistence(value) || undefined;
}
}
return (0, _checkExistence.default)(value) || null;
return checkExistence(value) || null;
}
}) || _class);
}) || _class);
export { RequiredIfRule as default };

@@ -1,17 +0,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _index = _interopRequireDefault(require("../index"));
var _checkExistence = _interopRequireDefault(require("../helpers/checkExistence"));
var _dec, _class;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let RequiredUnlessRule = exports.default = (_dec = (0, _rule.rule)('requiredUnless'), _dec(_class = class RequiredUnlessRule {
import { rule } from '../rule';
import Validator from '../index';
import checkExistence from '../helpers/checkExistence';
let RequiredUnlessRule = (_dec = rule('requiredUnless'), _dec(_class = class RequiredUnlessRule {
validate(validator, name, value, path, key) {
const results = _index.default.findData(validator.data, path.split('.'));
const results = Validator.findData(validator.data, path.split('.'));
if (results.length === 0) {
return (0, _checkExistence.default)(value) || undefined;
return checkExistence(value) || undefined;
}

@@ -23,7 +16,8 @@ for (let index = 0; index < results.length; index++) {

if ((typeof matchingValue === 'string' ? matchingValue : JSON.stringify(matchingValue)) === key) {
return (0, _checkExistence.default)(value) || undefined;
return checkExistence(value) || undefined;
}
}
return (0, _checkExistence.default)(value) || null;
return checkExistence(value) || null;
}
}) || _class);
}) || _class);
export { RequiredUnlessRule as default };

@@ -1,17 +0,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _index = _interopRequireDefault(require("../index"));
var _checkExistence = _interopRequireDefault(require("../helpers/checkExistence"));
var _dec, _class;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let RequiredWithRule = exports.default = (_dec = (0, _rule.rule)('requiredWith'), _dec(_class = class RequiredWithRule {
import { rule } from '../rule';
import Validator from '../index';
import checkExistence from '../helpers/checkExistence';
let RequiredWithRule = (_dec = rule('requiredWith'), _dec(_class = class RequiredWithRule {
validate(validator, name, value, path) {
const results = _index.default.findData(validator.data, path.split('.'));
const results = Validator.findData(validator.data, path.split('.'));
if (results.length === 0) {
return (0, _checkExistence.default)(value) || undefined;
return checkExistence(value) || undefined;
}

@@ -22,8 +15,9 @@ for (let index = 0; index < results.length; index++) {

} = results[index];
if (!(0, _checkExistence.default)(matchingValue)) {
return (0, _checkExistence.default)(value) || undefined;
if (!checkExistence(matchingValue)) {
return checkExistence(value) || undefined;
}
}
return (0, _checkExistence.default)(value) || null;
return checkExistence(value) || null;
}
}) || _class);
}) || _class);
export { RequiredWithRule as default };

@@ -1,17 +0,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _index = _interopRequireDefault(require("../index"));
var _checkExistence = _interopRequireDefault(require("../helpers/checkExistence"));
var _dec, _class;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let RequiredWithoutRule = exports.default = (_dec = (0, _rule.rule)('requiredWithout'), _dec(_class = class RequiredWithoutRule {
import { rule } from '../rule';
import Validator from '../index';
import checkExistence from '../helpers/checkExistence';
let RequiredWithoutRule = (_dec = rule('requiredWithout'), _dec(_class = class RequiredWithoutRule {
validate(validator, name, value, path) {
const results = _index.default.findData(validator.data, path.split('.'));
const results = Validator.findData(validator.data, path.split('.'));
if (results.length === 0) {
return (0, _checkExistence.default)(value) || null;
return checkExistence(value) || null;
}

@@ -22,8 +15,9 @@ for (let index = 0; index < results.length; index++) {

} = results[index];
if ((0, _checkExistence.default)(matchingValue)) {
return (0, _checkExistence.default)(value) || undefined;
if (checkExistence(matchingValue)) {
return checkExistence(value) || undefined;
}
}
return (0, _checkExistence.default)(value) || null;
return checkExistence(value) || null;
}
}) || _class);
}) || _class);
export { RequiredWithoutRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let RFC3339Rule = exports.default = (_dec = (0, _rule.rule)('rfc3339'), _dec(_class = class RFC3339Rule {
import { rule } from '../rule';
import { isRFC3339 } from 'validator';
let RFC3339Rule = (_dec = rule('rfc3339'), _dec(_class = class RFC3339Rule {
validate(validator, name, value) {
return (0, _validator.isRFC3339)(value);
return isRFC3339(value);
}
}) || _class);
}) || _class);
export { RFC3339Rule as default };

@@ -1,10 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let SizeRule = exports.default = (_dec = (0, _rule.rule)('size'), _dec(_class = class SizeRule {
import { rule } from '../rule';
let SizeRule = (_dec = rule('size'), _dec(_class = class SizeRule {
validate(validator, name, value, key) {

@@ -17,2 +11,3 @@ if (value instanceof Array || typeof value === 'string') {

}
}) || _class);
}) || _class);
export { SizeRule as default };

@@ -1,10 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _dec, _class;
let StartsWithRule = exports.default = (_dec = (0, _rule.rule)('startsWith'), _dec(_class = class StartsWithRule {
import { rule } from '../rule';
let StartsWithRule = (_dec = rule('startsWith'), _dec(_class = class StartsWithRule {
validate(validator, name, value, key) {

@@ -16,2 +10,3 @@ if (typeof value === 'string') {

}
}) || _class);
}) || _class);
export { StartsWithRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let SurrogatePairRule = exports.default = (_dec = (0, _rule.rule)('surrogate'), _dec(_class = class SurrogatePairRule {
import { rule } from '../rule';
import { isSurrogatePair } from 'validator';
let SurrogatePairRule = (_dec = rule('surrogate'), _dec(_class = class SurrogatePairRule {
validate(validator, name, value) {
return (0, _validator.isSurrogatePair)(value);
return isSurrogatePair(value);
}
}) || _class);
}) || _class);
export { SurrogatePairRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let UppercaseRule = exports.default = (_dec = (0, _rule.rule)('uppercase'), _dec(_class = class UppercaseRule {
import { rule } from '../rule';
import { isUppercase } from 'validator';
let UppercaseRule = (_dec = rule('uppercase'), _dec(_class = class UppercaseRule {
validate(validator, name, value) {
return (0, _validator.isUppercase)(value);
return isUppercase(value);
}
}) || _class);
}) || _class);
export { UppercaseRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let URLRule = exports.default = (_dec = (0, _rule.rule)('url'), _dec(_class = class URLRule {
import { rule } from '../rule';
import { isURL } from 'validator';
let URLRule = (_dec = rule('url'), _dec(_class = class URLRule {
validate(validator, name, value) {
return (0, _validator.isURL)(value);
return isURL(value);
}
}) || _class);
}) || _class);
export { URLRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let UUIDRule = exports.default = (_dec = (0, _rule.rule)('uuid'), _dec(_class = class UUIDRule {
import { rule } from '../rule';
import { isUUID } from 'validator';
let UUIDRule = (_dec = rule('uuid'), _dec(_class = class UUIDRule {
validate(validator, name, value, version) {
return (0, _validator.isUUID)(value, version);
return isUUID(value, version);
}
}) || _class);
}) || _class);
export { UUIDRule as default };

@@ -1,14 +0,9 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rule = require("../rule");
var _validator = require("validator");
var _dec, _class;
let VariableWidthRule = exports.default = (_dec = (0, _rule.rule)('variableWidth'), _dec(_class = class VariableWidthRule {
import { rule } from '../rule';
import { isVariableWidth } from 'validator';
let VariableWidthRule = (_dec = rule('variableWidth'), _dec(_class = class VariableWidthRule {
validate(validator, name, value) {
return (0, _validator.isVariableWidth)(value);
return isVariableWidth(value);
}
}) || _class);
}) || _class);
export { VariableWidthRule as default };
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