Socket
Socket
Sign inDemoInstall

validator

Package Overview
Dependencies
Maintainers
1
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validator - npm Package Compare versions

Comparing version 5.1.0 to 5.2.0

lib/isDataURI.js

9

CHANGELOG.md

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

#### 5.2.0
- Added a `isDataURI()` validator
([#521](https://github.com/chriso/validator.js/pull/521))
- Added Czech locales
([#522](https://github.com/chriso/validator.js/pull/522))
- Fixed a bug with `isURL()` when protocol was missing and "://" appeared in the query
([#518](https://github.com/chriso/validator.js/issues/518))
#### 5.1.0

@@ -2,0 +11,0 @@

8

index.js

@@ -195,2 +195,6 @@ 'use strict';

var _isDataURI = require('./lib/isDataURI');
var _isDataURI2 = _interopRequireDefault(_isDataURI);
var _ltrim = require('./lib/ltrim');

@@ -242,3 +246,3 @@

var version = '5.1.0';
var version = '5.2.0';

@@ -269,3 +273,3 @@ var validator = {

isISO8601: _isISO2.default,
isBase64: _isBase2.default,
isBase64: _isBase2.default, isDataURI: _isDataURI2.default,
ltrim: _ltrim2.default, rtrim: _rtrim2.default, trim: _trim2.default,

@@ -272,0 +276,0 @@ escape: _escape2.default, unescape: _unescape2.default, stripLow: _stripLow2.default,

@@ -8,2 +8,3 @@ 'use strict';

'en-US': /^[A-Z]+$/i,
'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
'de-DE': /^[A-ZÄÖÜß]+$/i,

@@ -22,2 +23,3 @@ 'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i,

'en-US': /^[0-9A-Z]+$/i,
'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
'de-DE': /^[0-9A-ZÄÖÜß]+$/i,

@@ -45,6 +47,6 @@ 'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,

for (var locale, i = 0; i < arabicLocales.length; i++) {
locale = 'ar-' + arabicLocales[i];
alpha[locale] = alpha.ar;
alphanumeric[locale] = alphanumeric.ar;
for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
_locale = 'ar-' + arabicLocales[_i];
alpha[_locale] = alpha.ar;
alphanumeric[_locale] = alphanumeric.ar;
}

@@ -20,4 +20,4 @@ 'use strict';

(0, _assertString2.default)(str);
var min = undefined;
var max = undefined;
var min = void 0;
var max = void 0;
if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {

@@ -24,0 +24,0 @@ min = options.min || 0;

@@ -25,5 +25,5 @@ 'use strict';

var sum = 0;
var digit = undefined;
var tmpNum = undefined;
var shouldDouble = undefined;
var digit = void 0;
var tmpNum = void 0;
var shouldDouble = void 0;
for (var i = sanitized.length - 1; i >= 0; i--) {

@@ -30,0 +30,0 @@ digit = sanitized.substring(i, i + 1);

@@ -18,6 +18,6 @@ 'use strict';

var iso8601Parts = str.match(_isISO.iso8601);
var timezone = undefined,
sign = undefined,
hours = undefined,
minutes = undefined;
var timezone = void 0,
sign = void 0,
hours = void 0,
minutes = void 0;
if (!iso8601Parts) {

@@ -79,5 +79,5 @@ str = str.toLowerCase();

var day = String(normalizedDate.getDate());
var dayOrYear = undefined,
dayOrYearMatches = undefined,
year = undefined;
var dayOrYear = void 0,
dayOrYearMatches = void 0,
year = void 0;
// check for valid double digits that could be late days

@@ -84,0 +84,0 @@ // check for all matches since a string like '12/23' is a valid date

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

(0, _assertString2.default)(str);
var i = undefined;
var i = void 0;
if (Object.prototype.toString.call(options) === '[object Array]') {

@@ -26,0 +26,0 @@ var array = [];

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

var checksum = 0;
var i = undefined;
var i = void 0;
if (version === '10') {

@@ -31,0 +31,0 @@ if (!isbn10Maybe.test(sanitized)) {

@@ -27,4 +27,4 @@ 'use strict';

var sum = 0;
var digit = undefined;
var tmpNum = undefined;
var digit = void 0;
var tmpNum = void 0;
var shouldDouble = true;

@@ -31,0 +31,0 @@ for (var i = checksumStr.length - 2; i >= 0; i--) {

@@ -20,4 +20,4 @@ 'use strict';

(0, _assertString2.default)(str);
var min = undefined;
var max = undefined;
var min = void 0;
var max = void 0;
if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {

@@ -24,0 +24,0 @@ min = options.min || 0;

@@ -18,2 +18,3 @@ 'use strict';

'en-US': /^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,
'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
'de-DE': /^(\+?49[ \.\-])?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,

@@ -20,0 +21,0 @@ 'el-GR': /^(\+?30)?(69\d{8})$/,

@@ -45,9 +45,16 @@ 'use strict';

options = (0, _merge2.default)(options, default_url_options);
var protocol = undefined,
auth = undefined,
host = undefined,
hostname = undefined,
port = undefined,
port_str = undefined,
split = undefined;
var protocol = void 0,
auth = void 0,
host = void 0,
hostname = void 0,
port = void 0,
port_str = void 0,
split = void 0;
split = url.split('#');
url = split.shift();
split = url.split('?');
url = split.shift();
split = url.split('://');

@@ -65,8 +72,3 @@ if (split.length > 1) {

url = split.join('://');
split = url.split('#');
url = split.shift();
split = url.split('?');
url = split.shift();
split = url.split('/');

@@ -73,0 +75,0 @@ url = split.shift();

{
"name": "validator",
"description": "String validation and sanitization",
"version": "5.1.0",
"version": "5.2.0",
"homepage": "http://github.com/chriso/validator.js",

@@ -6,0 +6,0 @@ "files": [

@@ -58,4 +58,4 @@ # validator.js

- **isAfter(str [, date])** - check if the string is a date that's after the specified date (defaults to now).
- **isAlpha(str [, locale])** - check if the string contains only letters (a-zA-Z). Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'de-DE', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'tr-TR']`) and defaults to `en-US`.
- **isAlphanumeric(str [, locale])** - check if the string contains only letters and numbers. Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'de-DE', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'tr-TR']`) and defaults to `en-US`.
- **isAlpha(str [, locale])** - check if the string contains only letters (a-zA-Z). Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'cs-CZ', 'de-DE', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'tr-TR']`) and defaults to `en-US`.
- **isAlphanumeric(str [, locale])** - check if the string contains only letters and numbers. Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'cs-CZ', 'de-DE', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fr-FR', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'tr-TR']`) and defaults to `en-US`.
- **isAscii(str)** - check if the string contains ASCII chars only.

@@ -68,2 +68,3 @@ - **isBase64(str)** - check if a string is base64 encoded.

- **isCurrency(str, options)** - check if the string is a valid currency amount. `options` is an object which defaults to `{symbol: '$', require_symbol: false, allow_space_after_symbol: false, symbol_after_digits: false, allow_negatives: true, parens_for_negatives: false, negative_sign_before_digits: false, negative_sign_after_digits: false, allow_negative_sign_placeholder: false, thousands_separator: ',', decimal_separator: '.', allow_space_after_digits: false }`.
- **isDataURI(str)** - check if the string is a [data uri format](https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs).
- **isDate(str)** - check if the string is a date.

@@ -89,3 +90,3 @@ - **isDecimal(str)** - check if the string represents a decimal number, such as 0.1, .3, 1.1, 1.00003, 4.0, etc.

- **isMACAddress(str)** - check if the string is a MAC address.
- **isMobilePhone(str, locale)** - check if the string is a mobile phone number, (locale is one of `['ar-SY', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fi-FI', 'fr-FR', 'ms-MY', 'nb-NO', 'nn-NO', 'pt-PT', 'ru-RU', 'tr-TR', 'vi-VN', 'zh-CN', 'zh-TW']`).
- **isMobilePhone(str, locale)** - check if the string is a mobile phone number, (locale is one of `['ar-SY', 'cs-CZ', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fi-FI', 'fr-FR', 'ms-MY', 'nb-NO', 'nn-NO', 'pt-PT', 'ru-RU', 'tr-TR', 'vi-VN', 'zh-CN', 'zh-TW']`).
- **isMongoId(str)** - check if the string is a valid hex-encoded representation of a [MongoDB ObjectId][mongoid].

@@ -123,3 +124,3 @@ - **isMultibyte(str)** - check if the string contains one or more multibyte chars.

For an alternative, look at Yahoo's [xss-filters library](https://github.com/yahoo/xss-filters).
For an alternative, have a look at Yahoo's [xss-filters library](https://github.com/yahoo/xss-filters) or at [DOMPurify](https://github.com/cure53/DOMPurify).

@@ -126,0 +127,0 @@ ### Tests

@@ -113,4 +113,4 @@ /*!

assertString(str);
var min = undefined;
var max = undefined;
var min = void 0;
var max = void 0;
if ((typeof options === 'undefined' ? 'undefined' : babelHelpers.typeof(options)) === 'object') {

@@ -314,9 +314,16 @@ min = options.min || 0;

options = merge(options, default_url_options);
var protocol = undefined,
auth = undefined,
host = undefined,
hostname = undefined,
port = undefined,
port_str = undefined,
split = undefined;
var protocol = void 0,
auth = void 0,
host = void 0,
hostname = void 0,
port = void 0,
port_str = void 0,
split = void 0;
split = url.split('#');
url = split.shift();
split = url.split('?');
url = split.shift();
split = url.split('://');

@@ -334,8 +341,3 @@ if (split.length > 1) {

url = split.join('://');
split = url.split('#');
url = split.shift();
split = url.split('?');
url = split.shift();
split = url.split('/');

@@ -386,2 +388,3 @@ url = split.shift();

'en-US': /^[A-Z]+$/i,
'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
'de-DE': /^[A-ZÄÖÜß]+$/i,

@@ -400,2 +403,3 @@ 'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i,

'en-US': /^[0-9A-Z]+$/i,
'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,
'de-DE': /^[0-9A-ZÄÖÜß]+$/i,

@@ -423,6 +427,6 @@ 'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,

for (var locale, i = 0; i < arabicLocales.length; i++) {
locale = 'ar-' + arabicLocales[i];
alpha[locale] = alpha.ar;
alphanumeric[locale] = alphanumeric.ar;
for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
_locale = 'ar-' + arabicLocales[_i];
alpha[_locale] = alpha.ar;
alphanumeric[_locale] = alphanumeric.ar;
}

@@ -569,4 +573,4 @@

assertString(str);
var min = undefined;
var max = undefined;
var min = void 0;
var max = void 0;
if ((typeof options === 'undefined' ? 'undefined' : babelHelpers.typeof(options)) === 'object') {

@@ -617,6 +621,6 @@ min = options.min || 0;

var iso8601Parts = str.match(iso8601);
var timezone = undefined,
sign = undefined,
hours = undefined,
minutes = undefined;
var timezone = void 0,
sign = void 0,
hours = void 0,
minutes = void 0;
if (!iso8601Parts) {

@@ -678,5 +682,5 @@ str = str.toLowerCase();

var day = String(normalizedDate.getDate());
var dayOrYear = undefined,
dayOrYearMatches = undefined,
year = undefined;
var dayOrYear = void 0,
dayOrYearMatches = void 0,
year = void 0;
// check for valid double digits that could be late days

@@ -722,3 +726,3 @@ // check for all matches since a string like '12/23' is a valid date

assertString(str);
var i = undefined;
var i = void 0;
if (Object.prototype.toString.call(options) === '[object Array]') {

@@ -751,5 +755,5 @@ var array = [];

var sum = 0;
var digit = undefined;
var tmpNum = undefined;
var shouldDouble = undefined;
var digit = void 0;
var tmpNum = void 0;
var shouldDouble = void 0;
for (var i = sanitized.length - 1; i >= 0; i--) {

@@ -786,4 +790,4 @@ digit = sanitized.substring(i, i + 1);

var sum = 0;
var digit = undefined;
var tmpNum = undefined;
var digit = void 0;
var tmpNum = void 0;
var shouldDouble = true;

@@ -823,3 +827,3 @@ for (var i = checksumStr.length - 2; i >= 0; i--) {

var checksum = 0;
var i = undefined;
var i = void 0;
if (version === '10') {

@@ -858,2 +862,3 @@ if (!isbn10Maybe.test(sanitized)) {

'en-US': /^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,
'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
'de-DE': /^(\+?49[ \.\-])?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,

@@ -975,2 +980,9 @@ 'el-GR': /^(\+?30)?(69\d{8})$/,

var dataURI = /^\s*data:([a-z]+\/[a-z0-9\-\+]+(;[a-z\-]+\=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i; // eslint-disable-line max-len
function isDataURI(str) {
assertString(str);
return dataURI.test(str);
}
function ltrim(str, chars) {

@@ -1061,3 +1073,3 @@ assertString(str);

var version = '5.1.0';
var version = '5.2.0';

@@ -1088,3 +1100,3 @@ var validator = {

isISO8601: isISO8601,
isBase64: isBase64,
isBase64: isBase64, isDataURI: isDataURI,
ltrim: ltrim, rtrim: rtrim, trim: trim,

@@ -1091,0 +1103,0 @@ escape: escape, unescape: unescape, stripLow: stripLow,

@@ -23,2 +23,2 @@ /*!

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.validator=t()}(this,function(){"use strict";function e(e){if("string"!=typeof e)throw new TypeError("This library (validator.js) validates strings only")}function t(t){return e(t),t=Date.parse(t),isNaN(t)?null:new Date(t)}function r(t){return e(t),parseFloat(t)}function n(t,r){return e(t),parseInt(t,r||10)}function i(t,r){return e(t),r?"1"===t||"true"===t:"0"!==t&&"false"!==t&&""!==t}function o(t,r){return e(t),t===r}function a(e){return"object"===("undefined"==typeof e?"undefined":se["typeof"](e))&&null!==e?e="function"==typeof e.toString?e.toString():"[object Object]":(null===e||"undefined"==typeof e||isNaN(e)&&!e.length)&&(e=""),String(e)}function u(t,r){return e(t),t.indexOf(a(r))>=0}function s(t,r,n){return e(t),"[object RegExp]"!==Object.prototype.toString.call(r)&&(r=new RegExp(r,n)),r.test(t)}function l(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];for(var r in t)"undefined"==typeof e[r]&&(e[r]=t[r]);return e}function f(t,r){e(t);var n=void 0,i=void 0;"object"===("undefined"==typeof r?"undefined":se["typeof"](r))?(n=r.min||0,i=r.max):(n=arguments[1],i=arguments[2]);var o=encodeURI(t).split(/%..|./).length-1;return o>=n&&("undefined"==typeof i||i>=o)}function d(t,r){e(t),r=l(r,fe),r.allow_trailing_dot&&"."===t[t.length-1]&&(t=t.substring(0,t.length-1));var n=t.split(".");if(r.require_tld){var i=n.pop();if(!n.length||!/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(i))return!1}for(var o,a=0;a<n.length;a++){if(o=n[a],r.allow_underscores&&(o=o.replace(/_/g,"")),!/^[a-z\u00a1-\uffff0-9-]+$/i.test(o))return!1;if(/[\uff01-\uff5e]/.test(o))return!1;if("-"===o[0]||"-"===o[o.length-1])return!1}return!0}function c(t,r){if(e(t),r=l(r,de),r.allow_display_name){var n=t.match(ce);n&&(t=n[1])}var i=t.split("@"),o=i.pop(),a=i.join("@"),u=o.toLowerCase();if(("gmail.com"===u||"googlemail.com"===u)&&(a=a.replace(/\./g,"").toLowerCase()),!f(a,{max:64})||!f(o,{max:256}))return!1;if(!d(o,{require_tld:r.require_tld}))return!1;if('"'===a[0])return a=a.slice(1,a.length-1),r.allow_utf8_local_part?ve.test(a):pe.test(a);for(var s=r.allow_utf8_local_part?Fe:ge,c=a.split("."),g=0;g<c.length;g++)if(!s.test(c[g]))return!1;return!0}function g(t){var r=arguments.length<=1||void 0===arguments[1]?"":arguments[1];if(e(t),r=String(r),!r)return g(t,4)||g(t,6);if("4"===r){if(!_e.test(t))return!1;var n=t.split(".").sort(function(e,t){return e-t});return n[3]<=255}if("6"===r){var i=t.split(":"),o=!1,a=g(i[i.length-1],4),u=a?7:8;if(i.length>u)return!1;if("::"===t)return!0;"::"===t.substr(0,2)?(i.shift(),i.shift(),o=!0):"::"===t.substr(t.length-2)&&(i.pop(),i.pop(),o=!0);for(var s=0;s<i.length;++s)if(""===i[s]&&s>0&&s<i.length-1){if(o)return!1;o=!0}else if(a&&s===i.length-1);else if(!me.test(i[s]))return!1;return o?i.length>=1:i.length===u}return!1}function p(t,r){if(e(t),!t||t.length>=2083||/\s/.test(t))return!1;if(0===t.indexOf("mailto:"))return!1;r=l(r,he);var n=void 0,i=void 0,o=void 0,a=void 0,u=void 0,s=void 0,f=void 0;if(f=t.split("://"),f.length>1){if(n=f.shift(),r.require_valid_protocol&&-1===r.protocols.indexOf(n))return!1}else{if(r.require_protocol)return!1;r.allow_protocol_relative_urls&&"//"===t.substr(0,2)&&(f[0]=t.substr(2))}return t=f.join("://"),f=t.split("#"),t=f.shift(),f=t.split("?"),t=f.shift(),f=t.split("/"),t=f.shift(),f=t.split("@"),f.length>1&&(i=f.shift(),i.indexOf(":")>=0&&i.split(":").length>2)?!1:(a=f.join("@"),f=a.split(":"),o=f.shift(),f.length&&(s=f.join(":"),u=parseInt(s,10),!/^[0-9]+$/.test(s)||0>=u||u>65535)?!1:g(o)||d(o,r)||"localhost"===o?r.host_whitelist&&-1===r.host_whitelist.indexOf(o)?!1:r.host_blacklist&&-1!==r.host_blacklist.indexOf(o)?!1:!0:!1)}function F(t){return e(t),xe.test(t)}function v(t){return e(t),["true","false","1","0"].indexOf(t)>=0}function _(t){var r=arguments.length<=1||void 0===arguments[1]?"en-US":arguments[1];if(e(t),r in $e)return $e[r].test(t);throw new Error("Invalid locale '"+r+"'")}function m(t){var r=arguments.length<=1||void 0===arguments[1]?"en-US":arguments[1];if(e(t),r in Ae)return Ae[r].test(t);throw new Error("Invalid locale '"+r+"'")}function h(t){return e(t),De.test(t)}function x(t){return e(t),t===t.toLowerCase()}function $(t){return e(t),t===t.toUpperCase()}function A(t){return e(t),Ee.test(t)}function w(t){return e(t),Se.test(t)}function y(t){return e(t),Ze.test(t)}function b(t){return e(t),Se.test(t)&&Ze.test(t)}function D(t){return e(t),Ie.test(t)}function E(t){return e(t),Oe.test(t)}function S(t,r){return e(t),r=r||{},Ce.test(t)&&(!r.hasOwnProperty("min")||t>=r.min)&&(!r.hasOwnProperty("max")||t<=r.max)}function Z(t,r){return e(t),r=r||{},""===t||"."===t?!1:Ne.test(t)&&(!r.hasOwnProperty("min")||t>=r.min)&&(!r.hasOwnProperty("max")||t<=r.max)}function I(t){return e(t),""!==t&&Re.test(t)}function O(t){return e(t),je.test(t)}function C(t,n){return e(t),r(t)%parseInt(n,10)===0}function N(t){return e(t),Le.test(t)}function R(t){e(t);try{var r=JSON.parse(t);return!!r&&"object"===("undefined"==typeof r?"undefined":se["typeof"](r))}catch(n){}return!1}function j(t){return e(t),0===t.length}function L(t,r){e(t);var n=void 0,i=void 0;"object"===("undefined"==typeof r?"undefined":se["typeof"](r))?(n=r.min||0,i=r.max):(n=arguments[1],i=arguments[2]);var o=t.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)||[],a=t.length-o.length;return a>=n&&("undefined"==typeof i||i>=a)}function U(t){var r=arguments.length<=1||void 0===arguments[1]?"all":arguments[1];e(t);var n=Ue[r];return n&&n.test(t)}function B(t){return e(t),O(t)&&24===t.length}function q(t){return e(t),Be.test(t)}function z(e){var t=e.match(Be),r=void 0,n=void 0,i=void 0,o=void 0;if(t){if(r=t[21],!r)return t[12]?null:0;if("z"===r||"Z"===r)return 0;n=t[22],-1!==r.indexOf(":")?(i=parseInt(t[23],10),o=parseInt(t[24],10)):(i=0,o=parseInt(t[23],10))}else{if(e=e.toLowerCase(),r=e.match(/(?:\s|gmt\s*)(-|\+)(\d{1,4})(\s|$)/),!r)return-1!==e.indexOf("gmt")?0:null;n=r[1];var a=r[2];3===a.length&&(a="0"+a),a.length<=2?(i=0,o=parseInt(a,10)):(i=parseInt(a.slice(0,2),10),o=parseInt(a.slice(2,4),10))}return(60*i+o)*("-"===n?1:-1)}function P(t){e(t);var r=new Date(Date.parse(t));if(isNaN(r))return!1;var n=z(t);if(null!==n){var i=r.getTimezoneOffset()-n;r=new Date(r.getTime()+6e4*i)}var o=String(r.getDate()),a=void 0,u=void 0,s=void 0;return(u=t.match(/(^|[^:\d])[23]\d([^:\d]|$)/g))?(a=u.map(function(e){return e.match(/\d+/g)[0]}).join("/"),s=String(r.getFullYear()).slice(-2),a===o||a===s?!0:a===""+o/s||a===""+s/o?!0:!1):!0}function T(r){var n=arguments.length<=1||void 0===arguments[1]?String(new Date):arguments[1];e(r);var i=t(n),o=t(r);return!!(o&&i&&o>i)}function M(r){var n=arguments.length<=1||void 0===arguments[1]?String(new Date):arguments[1];e(r);var i=t(n),o=t(r);return!!(o&&i&&i>o)}function W(t,r){e(t);var n=void 0;if("[object Array]"===Object.prototype.toString.call(r)){var i=[];for(n in r)({}).hasOwnProperty.call(r,n)&&(i[n]=a(r[n]));return i.indexOf(t)>=0}return"object"===("undefined"==typeof r?"undefined":se["typeof"](r))?r.hasOwnProperty(t):r&&"function"==typeof r.indexOf?r.indexOf(t)>=0:!1}function H(t){e(t);var r=t.replace(/[^0-9]+/g,"");if(!qe.test(r))return!1;for(var n=0,i=void 0,o=void 0,a=void 0,u=r.length-1;u>=0;u--)i=r.substring(u,u+1),o=parseInt(i,10),a?(o*=2,n+=o>=10?o%10+1:o):n+=o,a=!a;return!!(n%10===0?r:!1)}function Y(t){if(e(t),!ze.test(t))return!1;for(var r=t.replace(/[A-Z]/g,function(e){return parseInt(e,36)}),n=0,i=void 0,o=void 0,a=!0,u=r.length-2;u>=0;u--)i=r.substring(u,u+1),o=parseInt(i,10),a?(o*=2,n+=o>=10?o+1:o):n+=o,a=!a;return parseInt(t.substr(t.length-1),10)===(1e4-n)%10}function G(t){var r=arguments.length<=1||void 0===arguments[1]?"":arguments[1];if(e(t),r=String(r),!r)return G(t,10)||G(t,13);var n=t.replace(/[\s-]+/g,""),i=0,o=void 0;if("10"===r){if(!Pe.test(n))return!1;for(o=0;9>o;o++)i+=(o+1)*n.charAt(o);if(i+="X"===n.charAt(9)?100:10*n.charAt(9),i%11===0)return!!n}else if("13"===r){if(!Te.test(n))return!1;for(o=0;12>o;o++)i+=Me[o%2]*n.charAt(o);if(n.charAt(12)-(10-i%10)%10===0)return!!n}return!1}function Q(t,r){return e(t),r in We?We[r].test(t):!1}function k(e){var t="(\\"+e.symbol.replace(/\./g,"\\.")+")"+(e.require_symbol?"":"?"),r="-?",n="[1-9]\\d*",i="[1-9]\\d{0,2}(\\"+e.thousands_separator+"\\d{3})*",o=["0",n,i],a="("+o.join("|")+")?",u="(\\"+e.decimal_separator+"\\d{2})?",s=a+u;return e.allow_negatives&&!e.parens_for_negatives&&(e.negative_sign_after_digits?s+=r:e.negative_sign_before_digits&&(s=r+s)),e.allow_negative_sign_placeholder?s="( (?!\\-))?"+s:e.allow_space_after_symbol?s=" ?"+s:e.allow_space_after_digits&&(s+="( (?!$))?"),e.symbol_after_digits?s+=t:s=t+s,e.allow_negatives&&(e.parens_for_negatives?s="(\\("+s+"\\)|"+s+")":e.negative_sign_before_digits||e.negative_sign_after_digits||(s=r+s)),new RegExp("^(?!-? )(?=.*\\d)"+s+"$")}function J(t,r){return e(t),r=l(r,He),k(r).test(t)}function K(t){e(t);var r=t.length;if(!r||r%4!==0||Ye.test(t))return!1;var n=t.indexOf("=");return-1===n||n===r-1||n===r-2&&"="===t[r-1]}function V(t,r){e(t);var n=r?new RegExp("^["+r+"]+","g"):/^\s+/g;return t.replace(n,"")}function X(t,r){e(t);var n=r?new RegExp("["+r+"]+$","g"):/\s+$/g;return t.replace(n,"")}function ee(t,r){e(t);var n=r?new RegExp("^["+r+"]+|["+r+"]+$","g"):/^\s+|\s+$/g;return t.replace(n,"")}function te(t){return e(t),t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\//g,"&#x2F;").replace(/\`/g,"&#96;")}function re(t){return e(t),t.replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#x2F;/g,"/").replace(/&#96;/g,"`")}function ne(t,r){return e(t),t.replace(new RegExp("["+r+"]+","g"),"")}function ie(t,r){e(t);var n=r?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F";return ne(t,n)}function oe(t,r){return e(t),t.replace(new RegExp("[^"+r+"]+","g"),"")}function ae(t,r){e(t);for(var n=t.length-1;n>=0;n--)if(-1===r.indexOf(t[n]))return!1;return!0}function ue(e,t){if(t=l(t,Ge),!c(e))return!1;var r=e.split("@",2);if(r[1]=r[1].toLowerCase(),"gmail.com"===r[1]||"googlemail.com"===r[1]){if(t.remove_extension&&(r[0]=r[0].split("+")[0]),t.remove_dots&&(r[0]=r[0].replace(/\./g,"")),!r[0].length)return!1;r[0]=r[0].toLowerCase(),r[1]="gmail.com"}else t.lowercase&&(r[0]=r[0].toLowerCase());return r.join("@")}var se={};se["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};for(var le,fe={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1},de={allow_display_name:!1,allow_utf8_local_part:!0,require_tld:!0},ce=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i,ge=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,pe=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,Fe=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,ve=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i,_e=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,me=/^[0-9A-F]{1,4}$/i,he={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1},xe=/^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/,$e={"en-US":/^[A-Z]+$/i,"de-DE":/^[A-ZÄÖÜß]+$/i,"es-ES":/^[A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"nl-NL":/^[A-ZÉËÏÓÖÜ]+$/i,"pl-PL":/^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,"ru-RU":/^[А-ЯЁа-яё]+$/i,"tr-TR":/^[A-ZÇĞİıÖŞÜ]+$/i,ar:/^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},Ae={"en-US":/^[0-9A-Z]+$/i,"de-DE":/^[0-9A-ZÄÖÜß]+$/i,"es-ES":/^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"nl-NL":/^[0-9A-ZÉËÏÓÖÜ]+$/i,"pl-PL":/^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,"ru-RU":/^[0-9А-ЯЁа-яё]+$/i,"tr-TR":/^[0-9A-ZÇĞİıÖŞÜ]+$/i,ar:/^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},we=["AU","GB","HK","IN","NZ","ZA","ZM"],ye=0;ye<we.length;ye++)le="en-"+we[ye],$e[le]=$e["en-US"],Ae[le]=Ae["en-US"];for(var le,be=["AE","BH","DZ","EG","IQ","JO","KW","LB","LY","MA","QM","QA","SA","SD","SY","TN","YE"],ye=0;ye<be.length;ye++)le="ar-"+be[ye],$e[le]=$e.ar,Ae[le]=Ae.ar;var De=/^[-+]?[0-9]+$/,Ee=/^[\x00-\x7F]+$/,Se=/[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/,Ze=/[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/,Ie=/[^\x00-\x7F]/,Oe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/,Ce=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,Ne=/^(?:[-+]?(?:[0-9]+))?(?:\.[0-9]*)?(?:[eE][\+\-]?(?:[0-9]+))?$/,Re=/^[-+]?([0-9]+|\.[0-9]+|[0-9]+\.[0-9]+)$/,je=/^[0-9A-F]+$/i,Le=/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i,Ue={3:/^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,4:/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,5:/^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,all:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i},Be=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,qe=/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,ze=/^[A-Z]{2}[0-9A-Z]{9}[0-9]$/,Pe=/^(?:[0-9]{9}X|[0-9]{10})$/,Te=/^(?:[0-9]{13})$/,Me=[1,3],We={"ar-SY":/^(!?(\+?963)|0)?9\d{8}$/,"en-US":/^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,"de-DE":/^(\+?49[ \.\-])?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,"el-GR":/^(\+?30)?(69\d{8})$/,"en-AU":/^(\+?61|0)4\d{8}$/,"en-GB":/^(\+?44|0)7\d{9}$/,"en-HK":/^(\+?852\-?)?[569]\d{3}\-?\d{4}$/,"en-IN":/^(\+?91|0)?[789]\d{9}$/,"en-NZ":/^(\+?64|0)2\d{7,9}$/,"en-ZA":/^(\+?27|0)\d{9}$/,"en-ZM":/^(\+?26)?09[567]\d{7}$/,"es-ES":/^(\+?34)?(6\d{1}|7[1234])\d{7}$/,"fi-FI":/^(\+?358|0)\s?(4(0|1|2|4|5)?|50)\s?(\d\s?){4,8}\d$/,"fr-FR":/^(\+?33|0)[67]\d{8}$/,"ms-MY":/^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,"nb-NO":/^(\+?47)?[49]\d{7}$/,"nn-NO":/^(\+?47)?[49]\d{7}$/,"pt-BR":/^(\+?55|0)\-?[1-9]{2}\-?[2-9]{1}\d{3,4}\-?\d{4}$/,"pt-PT":/^(\+?351)?9[1236]\d{7}$/,"ru-RU":/^(\+?7|8)?9\d{9}$/,"tr-TR":/^(\+?90|0)?5\d{9}$/,"vi-VN":/^(\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,"zh-CN":/^(\+?0?86\-?)?((13\d|14[57]|15[^4,\D]|17[678]|18\d)\d{8}|170[059]\d{7})$/,"zh-TW":/^(\+?886\-?|0)?9\d{8}$/},He={symbol:"$",require_symbol:!1,allow_space_after_symbol:!1,symbol_after_digits:!1,allow_negatives:!0,parens_for_negatives:!1,negative_sign_before_digits:!1,negative_sign_after_digits:!1,allow_negative_sign_placeholder:!1,thousands_separator:",",decimal_separator:".",allow_space_after_digits:!1},Ye=/[^A-Z0-9+\/=]/i,Ge={lowercase:!0,remove_dots:!0,remove_extension:!0},Qe="5.1.0",ke={version:Qe,toDate:t,toFloat:r,toInt:n,toBoolean:i,equals:o,contains:u,matches:s,isEmail:c,isURL:p,isMACAddress:F,isIP:g,isFQDN:d,isBoolean:v,isAlpha:_,isAlphanumeric:m,isNumeric:h,isLowercase:x,isUppercase:$,isAscii:A,isFullWidth:w,isHalfWidth:y,isVariableWidth:b,isMultibyte:D,isSurrogatePair:E,isInt:S,isFloat:Z,isDecimal:I,isHexadecimal:O,isDivisibleBy:C,isHexColor:N,isJSON:R,isNull:j,isLength:L,isByteLength:f,isUUID:U,isMongoId:B,isDate:P,isAfter:T,isBefore:M,isIn:W,isCreditCard:H,isISIN:Y,isISBN:G,isMobilePhone:Q,isCurrency:J,isISO8601:q,isBase64:K,ltrim:V,rtrim:X,trim:ee,escape:te,unescape:re,stripLow:ie,whitelist:oe,blacklist:ne,isWhitelisted:ae,normalizeEmail:ue,toString:a};return ke});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.validator=t()}(this,function(){"use strict";function e(e){if("string"!=typeof e)throw new TypeError("This library (validator.js) validates strings only")}function t(t){return e(t),t=Date.parse(t),isNaN(t)?null:new Date(t)}function r(t){return e(t),parseFloat(t)}function n(t,r){return e(t),parseInt(t,r||10)}function i(t,r){return e(t),r?"1"===t||"true"===t:"0"!==t&&"false"!==t&&""!==t}function o(t,r){return e(t),t===r}function a(e){return"object"===("undefined"==typeof e?"undefined":le["typeof"](e))&&null!==e?e="function"==typeof e.toString?e.toString():"[object Object]":(null===e||"undefined"==typeof e||isNaN(e)&&!e.length)&&(e=""),String(e)}function u(t,r){return e(t),t.indexOf(a(r))>=0}function s(t,r,n){return e(t),"[object RegExp]"!==Object.prototype.toString.call(r)&&(r=new RegExp(r,n)),r.test(t)}function l(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];for(var r in t)"undefined"==typeof e[r]&&(e[r]=t[r]);return e}function f(t,r){e(t);var n=void 0,i=void 0;"object"===("undefined"==typeof r?"undefined":le["typeof"](r))?(n=r.min||0,i=r.max):(n=arguments[1],i=arguments[2]);var o=encodeURI(t).split(/%..|./).length-1;return o>=n&&("undefined"==typeof i||i>=o)}function d(t,r){e(t),r=l(r,de),r.allow_trailing_dot&&"."===t[t.length-1]&&(t=t.substring(0,t.length-1));var n=t.split(".");if(r.require_tld){var i=n.pop();if(!n.length||!/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(i))return!1}for(var o,a=0;a<n.length;a++){if(o=n[a],r.allow_underscores&&(o=o.replace(/_/g,"")),!/^[a-z\u00a1-\uffff0-9-]+$/i.test(o))return!1;if(/[\uff01-\uff5e]/.test(o))return!1;if("-"===o[0]||"-"===o[o.length-1])return!1}return!0}function c(t,r){if(e(t),r=l(r,ce),r.allow_display_name){var n=t.match(pe);n&&(t=n[1])}var i=t.split("@"),o=i.pop(),a=i.join("@"),u=o.toLowerCase();if("gmail.com"!==u&&"googlemail.com"!==u||(a=a.replace(/\./g,"").toLowerCase()),!f(a,{max:64})||!f(o,{max:256}))return!1;if(!d(o,{require_tld:r.require_tld}))return!1;if('"'===a[0])return a=a.slice(1,a.length-1),r.allow_utf8_local_part?_e.test(a):Fe.test(a);for(var s=r.allow_utf8_local_part?ve:ge,c=a.split("."),p=0;p<c.length;p++)if(!s.test(c[p]))return!1;return!0}function p(t){var r=arguments.length<=1||void 0===arguments[1]?"":arguments[1];if(e(t),r=String(r),!r)return p(t,4)||p(t,6);if("4"===r){if(!he.test(t))return!1;var n=t.split(".").sort(function(e,t){return e-t});return n[3]<=255}if("6"===r){var i=t.split(":"),o=!1,a=p(i[i.length-1],4),u=a?7:8;if(i.length>u)return!1;if("::"===t)return!0;"::"===t.substr(0,2)?(i.shift(),i.shift(),o=!0):"::"===t.substr(t.length-2)&&(i.pop(),i.pop(),o=!0);for(var s=0;s<i.length;++s)if(""===i[s]&&s>0&&s<i.length-1){if(o)return!1;o=!0}else if(a&&s===i.length-1);else if(!xe.test(i[s]))return!1;return o?i.length>=1:i.length===u}return!1}function g(t,r){if(e(t),!t||t.length>=2083||/\s/.test(t))return!1;if(0===t.indexOf("mailto:"))return!1;r=l(r,$e);var n=void 0,i=void 0,o=void 0,a=void 0,u=void 0,s=void 0,f=void 0;if(f=t.split("#"),t=f.shift(),f=t.split("?"),t=f.shift(),f=t.split("://"),f.length>1){if(n=f.shift(),r.require_valid_protocol&&-1===r.protocols.indexOf(n))return!1}else{if(r.require_protocol)return!1;r.allow_protocol_relative_urls&&"//"===t.substr(0,2)&&(f[0]=t.substr(2))}return t=f.join("://"),f=t.split("/"),t=f.shift(),f=t.split("@"),f.length>1&&(i=f.shift(),i.indexOf(":")>=0&&i.split(":").length>2)?!1:(a=f.join("@"),f=a.split(":"),o=f.shift(),f.length&&(s=f.join(":"),u=parseInt(s,10),!/^[0-9]+$/.test(s)||0>=u||u>65535)?!1:p(o)||d(o,r)||"localhost"===o?r.host_whitelist&&-1===r.host_whitelist.indexOf(o)?!1:!r.host_blacklist||-1===r.host_blacklist.indexOf(o):!1)}function F(t){return e(t),Ae.test(t)}function v(t){return e(t),["true","false","1","0"].indexOf(t)>=0}function _(t){var r=arguments.length<=1||void 0===arguments[1]?"en-US":arguments[1];if(e(t),r in me)return me[r].test(t);throw new Error("Invalid locale '"+r+"'")}function h(t){var r=arguments.length<=1||void 0===arguments[1]?"en-US":arguments[1];if(e(t),r in we)return we[r].test(t);throw new Error("Invalid locale '"+r+"'")}function x(t){return e(t),Ze.test(t)}function $(t){return e(t),t===t.toLowerCase()}function A(t){return e(t),t===t.toUpperCase()}function m(t){return e(t),Ie.test(t)}function w(t){return e(t),Oe.test(t)}function y(t){return e(t),Ce.test(t)}function b(t){return e(t),Oe.test(t)&&Ce.test(t)}function D(t){return e(t),Ne.test(t)}function E(t){return e(t),Re.test(t)}function S(t,r){return e(t),r=r||{},je.test(t)&&(!r.hasOwnProperty("min")||t>=r.min)&&(!r.hasOwnProperty("max")||t<=r.max)}function Z(t,r){return e(t),r=r||{},""===t||"."===t?!1:ze.test(t)&&(!r.hasOwnProperty("min")||t>=r.min)&&(!r.hasOwnProperty("max")||t<=r.max)}function I(t){return e(t),""!==t&&Ue.test(t)}function O(t){return e(t),Le.test(t)}function C(t,n){return e(t),r(t)%parseInt(n,10)===0}function N(t){return e(t),Be.test(t)}function R(t){e(t);try{var r=JSON.parse(t);return!!r&&"object"===("undefined"==typeof r?"undefined":le["typeof"](r))}catch(n){}return!1}function j(t){return e(t),0===t.length}function z(t,r){e(t);var n=void 0,i=void 0;"object"===("undefined"==typeof r?"undefined":le["typeof"](r))?(n=r.min||0,i=r.max):(n=arguments[1],i=arguments[2]);var o=t.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)||[],a=t.length-o.length;return a>=n&&("undefined"==typeof i||i>=a)}function U(t){var r=arguments.length<=1||void 0===arguments[1]?"all":arguments[1];e(t);var n=qe[r];return n&&n.test(t)}function L(t){return e(t),O(t)&&24===t.length}function B(t){return e(t),Pe.test(t)}function q(e){var t=e.match(Pe),r=void 0,n=void 0,i=void 0,o=void 0;if(t){if(r=t[21],!r)return t[12]?null:0;if("z"===r||"Z"===r)return 0;n=t[22],-1!==r.indexOf(":")?(i=parseInt(t[23],10),o=parseInt(t[24],10)):(i=0,o=parseInt(t[23],10))}else{if(e=e.toLowerCase(),r=e.match(/(?:\s|gmt\s*)(-|\+)(\d{1,4})(\s|$)/),!r)return-1!==e.indexOf("gmt")?0:null;n=r[1];var a=r[2];3===a.length&&(a="0"+a),a.length<=2?(i=0,o=parseInt(a,10)):(i=parseInt(a.slice(0,2),10),o=parseInt(a.slice(2,4),10))}return(60*i+o)*("-"===n?1:-1)}function P(t){e(t);var r=new Date(Date.parse(t));if(isNaN(r))return!1;var n=q(t);if(null!==n){var i=r.getTimezoneOffset()-n;r=new Date(r.getTime()+6e4*i)}var o=String(r.getDate()),a=void 0,u=void 0,s=void 0;return(u=t.match(/(^|[^:\d])[23]\d([^:\d]|$)/g))?(a=u.map(function(e){return e.match(/\d+/g)[0]}).join("/"),s=String(r.getFullYear()).slice(-2),a===o||a===s?!0:a===""+o/s||a===""+s/o):!0}function T(r){var n=arguments.length<=1||void 0===arguments[1]?String(new Date):arguments[1];e(r);var i=t(n),o=t(r);return!!(o&&i&&o>i)}function M(r){var n=arguments.length<=1||void 0===arguments[1]?String(new Date):arguments[1];e(r);var i=t(n),o=t(r);return!!(o&&i&&i>o)}function W(t,r){e(t);var n=void 0;if("[object Array]"===Object.prototype.toString.call(r)){var i=[];for(n in r)({}).hasOwnProperty.call(r,n)&&(i[n]=a(r[n]));return i.indexOf(t)>=0}return"object"===("undefined"==typeof r?"undefined":le["typeof"](r))?r.hasOwnProperty(t):r&&"function"==typeof r.indexOf?r.indexOf(t)>=0:!1}function H(t){e(t);var r=t.replace(/[^0-9]+/g,"");if(!Te.test(r))return!1;for(var n=0,i=void 0,o=void 0,a=void 0,u=r.length-1;u>=0;u--)i=r.substring(u,u+1),o=parseInt(i,10),a?(o*=2,n+=o>=10?o%10+1:o):n+=o,a=!a;return!!(n%10===0?r:!1)}function Y(t){if(e(t),!Me.test(t))return!1;for(var r=t.replace(/[A-Z]/g,function(e){return parseInt(e,36)}),n=0,i=void 0,o=void 0,a=!0,u=r.length-2;u>=0;u--)i=r.substring(u,u+1),o=parseInt(i,10),a?(o*=2,n+=o>=10?o+1:o):n+=o,a=!a;return parseInt(t.substr(t.length-1),10)===(1e4-n)%10}function G(t){var r=arguments.length<=1||void 0===arguments[1]?"":arguments[1];if(e(t),r=String(r),!r)return G(t,10)||G(t,13);var n=t.replace(/[\s-]+/g,""),i=0,o=void 0;if("10"===r){if(!We.test(n))return!1;for(o=0;9>o;o++)i+=(o+1)*n.charAt(o);if(i+="X"===n.charAt(9)?100:10*n.charAt(9),i%11===0)return!!n}else if("13"===r){if(!He.test(n))return!1;for(o=0;12>o;o++)i+=Ye[o%2]*n.charAt(o);if(n.charAt(12)-(10-i%10)%10===0)return!!n}return!1}function Q(t,r){return e(t),r in Ge?Ge[r].test(t):!1}function k(e){var t="(\\"+e.symbol.replace(/\./g,"\\.")+")"+(e.require_symbol?"":"?"),r="-?",n="[1-9]\\d*",i="[1-9]\\d{0,2}(\\"+e.thousands_separator+"\\d{3})*",o=["0",n,i],a="("+o.join("|")+")?",u="(\\"+e.decimal_separator+"\\d{2})?",s=a+u;return e.allow_negatives&&!e.parens_for_negatives&&(e.negative_sign_after_digits?s+=r:e.negative_sign_before_digits&&(s=r+s)),e.allow_negative_sign_placeholder?s="( (?!\\-))?"+s:e.allow_space_after_symbol?s=" ?"+s:e.allow_space_after_digits&&(s+="( (?!$))?"),e.symbol_after_digits?s+=t:s=t+s,e.allow_negatives&&(e.parens_for_negatives?s="(\\("+s+"\\)|"+s+")":e.negative_sign_before_digits||e.negative_sign_after_digits||(s=r+s)),new RegExp("^(?!-? )(?=.*\\d)"+s+"$")}function J(t,r){return e(t),r=l(r,Qe),k(r).test(t)}function K(t){e(t);var r=t.length;if(!r||r%4!==0||ke.test(t))return!1;var n=t.indexOf("=");return-1===n||n===r-1||n===r-2&&"="===t[r-1]}function V(t){return e(t),Je.test(t)}function X(t,r){e(t);var n=r?new RegExp("^["+r+"]+","g"):/^\s+/g;return t.replace(n,"")}function ee(t,r){e(t);var n=r?new RegExp("["+r+"]+$","g"):/\s+$/g;return t.replace(n,"")}function te(t,r){e(t);var n=r?new RegExp("^["+r+"]+|["+r+"]+$","g"):/^\s+|\s+$/g;return t.replace(n,"")}function re(t){return e(t),t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\//g,"&#x2F;").replace(/\`/g,"&#96;")}function ne(t){return e(t),t.replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&#x2F;/g,"/").replace(/&#96;/g,"`")}function ie(t,r){return e(t),t.replace(new RegExp("["+r+"]+","g"),"")}function oe(t,r){e(t);var n=r?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F";return ie(t,n)}function ae(t,r){return e(t),t.replace(new RegExp("[^"+r+"]+","g"),"")}function ue(t,r){e(t);for(var n=t.length-1;n>=0;n--)if(-1===r.indexOf(t[n]))return!1;return!0}function se(e,t){if(t=l(t,Ke),!c(e))return!1;var r=e.split("@",2);if(r[1]=r[1].toLowerCase(),"gmail.com"===r[1]||"googlemail.com"===r[1]){if(t.remove_extension&&(r[0]=r[0].split("+")[0]),t.remove_dots&&(r[0]=r[0].replace(/\./g,"")),!r[0].length)return!1;r[0]=r[0].toLowerCase(),r[1]="gmail.com"}else t.lowercase&&(r[0]=r[0].toLowerCase());return r.join("@")}var le={};le["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};for(var fe,de={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1},ce={allow_display_name:!1,allow_utf8_local_part:!0,require_tld:!0},pe=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i,ge=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,Fe=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,ve=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,_e=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i,he=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,xe=/^[0-9A-F]{1,4}$/i,$e={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1},Ae=/^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/,me={"en-US":/^[A-Z]+$/i,"cs-CZ":/^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"de-DE":/^[A-ZÄÖÜß]+$/i,"es-ES":/^[A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"nl-NL":/^[A-ZÉËÏÓÖÜ]+$/i,"pl-PL":/^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,"ru-RU":/^[А-ЯЁа-яё]+$/i,"tr-TR":/^[A-ZÇĞİıÖŞÜ]+$/i,ar:/^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},we={"en-US":/^[0-9A-Z]+$/i,"cs-CZ":/^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"de-DE":/^[0-9A-ZÄÖÜß]+$/i,"es-ES":/^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"nl-NL":/^[0-9A-ZÉËÏÓÖÜ]+$/i,"pl-PL":/^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,"ru-RU":/^[0-9А-ЯЁа-яё]+$/i,"tr-TR":/^[0-9A-ZÇĞİıÖŞÜ]+$/i,ar:/^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},ye=["AU","GB","HK","IN","NZ","ZA","ZM"],be=0;be<ye.length;be++)fe="en-"+ye[be],me[fe]=me["en-US"],we[fe]=we["en-US"];for(var De,Ee=["AE","BH","DZ","EG","IQ","JO","KW","LB","LY","MA","QM","QA","SA","SD","SY","TN","YE"],Se=0;Se<Ee.length;Se++)De="ar-"+Ee[Se],me[De]=me.ar,we[De]=we.ar;var Ze=/^[-+]?[0-9]+$/,Ie=/^[\x00-\x7F]+$/,Oe=/[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/,Ce=/[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/,Ne=/[^\x00-\x7F]/,Re=/[\uD800-\uDBFF][\uDC00-\uDFFF]/,je=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,ze=/^(?:[-+]?(?:[0-9]+))?(?:\.[0-9]*)?(?:[eE][\+\-]?(?:[0-9]+))?$/,Ue=/^[-+]?([0-9]+|\.[0-9]+|[0-9]+\.[0-9]+)$/,Le=/^[0-9A-F]+$/i,Be=/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i,qe={3:/^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,4:/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,5:/^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,all:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i},Pe=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,Te=/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,Me=/^[A-Z]{2}[0-9A-Z]{9}[0-9]$/,We=/^(?:[0-9]{9}X|[0-9]{10})$/,He=/^(?:[0-9]{13})$/,Ye=[1,3],Ge={"ar-SY":/^(!?(\+?963)|0)?9\d{8}$/,"en-US":/^(\+?1)?[2-9]\d{2}[2-9](?!11)\d{6}$/,"cs-CZ":/^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,"de-DE":/^(\+?49[ \.\-])?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,"el-GR":/^(\+?30)?(69\d{8})$/,"en-AU":/^(\+?61|0)4\d{8}$/,"en-GB":/^(\+?44|0)7\d{9}$/,"en-HK":/^(\+?852\-?)?[569]\d{3}\-?\d{4}$/,"en-IN":/^(\+?91|0)?[789]\d{9}$/,"en-NZ":/^(\+?64|0)2\d{7,9}$/,"en-ZA":/^(\+?27|0)\d{9}$/,"en-ZM":/^(\+?26)?09[567]\d{7}$/,"es-ES":/^(\+?34)?(6\d{1}|7[1234])\d{7}$/,"fi-FI":/^(\+?358|0)\s?(4(0|1|2|4|5)?|50)\s?(\d\s?){4,8}\d$/,"fr-FR":/^(\+?33|0)[67]\d{8}$/,"ms-MY":/^(\+?6?01){1}(([145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,"nb-NO":/^(\+?47)?[49]\d{7}$/,"nn-NO":/^(\+?47)?[49]\d{7}$/,"pt-BR":/^(\+?55|0)\-?[1-9]{2}\-?[2-9]{1}\d{3,4}\-?\d{4}$/,"pt-PT":/^(\+?351)?9[1236]\d{7}$/,"ru-RU":/^(\+?7|8)?9\d{9}$/,"tr-TR":/^(\+?90|0)?5\d{9}$/,"vi-VN":/^(\+?84|0)?((1(2([0-9])|6([2-9])|88|99))|(9((?!5)[0-9])))([0-9]{7})$/,"zh-CN":/^(\+?0?86\-?)?((13\d|14[57]|15[^4,\D]|17[678]|18\d)\d{8}|170[059]\d{7})$/,"zh-TW":/^(\+?886\-?|0)?9\d{8}$/},Qe={symbol:"$",require_symbol:!1,allow_space_after_symbol:!1,symbol_after_digits:!1,allow_negatives:!0,parens_for_negatives:!1,negative_sign_before_digits:!1,negative_sign_after_digits:!1,allow_negative_sign_placeholder:!1,thousands_separator:",",decimal_separator:".",allow_space_after_digits:!1},ke=/[^A-Z0-9+\/=]/i,Je=/^\s*data:([a-z]+\/[a-z0-9\-\+]+(;[a-z\-]+\=[a-z0-9\-]+)?)?(;base64)?,[a-z0-9\!\$\&\'\,\(\)\*\+\,\;\=\-\.\_\~\:\@\/\?\%\s]*\s*$/i,Ke={lowercase:!0,remove_dots:!0,remove_extension:!0},Ve="5.2.0",Xe={version:Ve,toDate:t,toFloat:r,toInt:n,toBoolean:i,equals:o,contains:u,matches:s,isEmail:c,isURL:g,isMACAddress:F,isIP:p,isFQDN:d,isBoolean:v,isAlpha:_,isAlphanumeric:h,isNumeric:x,isLowercase:$,isUppercase:A,isAscii:m,isFullWidth:w,isHalfWidth:y,isVariableWidth:b,isMultibyte:D,isSurrogatePair:E,isInt:S,isFloat:Z,isDecimal:I,isHexadecimal:O,isDivisibleBy:C,isHexColor:N,isJSON:R,isNull:j,isLength:z,isByteLength:f,isUUID:U,isMongoId:L,isDate:P,isAfter:T,isBefore:M,isIn:W,isCreditCard:H,isISIN:Y,isISBN:G,isMobilePhone:Q,isCurrency:J,isISO8601:B,isBase64:K,isDataURI:V,ltrim:X,rtrim:ee,trim:te,escape:re,unescape:ne,stripLow:oe,whitelist:ae,blacklist:ie,isWhitelisted:ue,normalizeEmail:se,toString:a};return Xe});
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