async-validator
Advanced tools
Comparing version 4.1.1 to 4.2.3
@@ -6,3 +6,3 @@ 'use strict'; | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
_extends = Object.assign ? Object.assign.bind() : function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
@@ -20,3 +20,2 @@ var source = arguments[i]; | ||
}; | ||
return _extends.apply(this, arguments); | ||
@@ -33,3 +32,3 @@ } | ||
function _getPrototypeOf(o) { | ||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { | ||
return o.__proto__ || Object.getPrototypeOf(o); | ||
@@ -41,7 +40,6 @@ }; | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
@@ -65,3 +63,3 @@ } | ||
if (_isNativeReflectConstruct()) { | ||
_construct = Reflect.construct; | ||
_construct = Reflect.construct.bind(); | ||
} else { | ||
@@ -416,2 +414,48 @@ _construct = function _construct(Parent, args, Class) { | ||
// https://github.com/kevva/url-regex/blob/master/index.js | ||
var word = '[a-fA-F\\d:]'; | ||
var b = function b(options) { | ||
return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : ''; | ||
}; | ||
var v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}'; | ||
var v6seg = '[a-fA-F\\d]{1,4}'; | ||
var v6 = ("\n(?:\n(?:" + v6seg + ":){7}(?:" + v6seg + "|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:" + v6seg + ":){6}(?:" + v4 + "|:" + v6seg + "|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:" + v6seg + ":){5}(?::" + v4 + "|(?::" + v6seg + "){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:" + v6seg + ":){4}(?:(?::" + v6seg + "){0,1}:" + v4 + "|(?::" + v6seg + "){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:" + v6seg + ":){3}(?:(?::" + v6seg + "){0,2}:" + v4 + "|(?::" + v6seg + "){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:" + v6seg + ":){2}(?:(?::" + v6seg + "){0,3}:" + v4 + "|(?::" + v6seg + "){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:" + v6seg + ":){1}(?:(?::" + v6seg + "){0,4}:" + v4 + "|(?::" + v6seg + "){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::" + v6seg + "){0,5}:" + v4 + "|(?::" + v6seg + "){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim(); // Pre-compile only the exact regexes because adding a global flag make regexes stateful | ||
var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)"); | ||
var v4exact = new RegExp("^" + v4 + "$"); | ||
var v6exact = new RegExp("^" + v6 + "$"); | ||
var ip = function ip(options) { | ||
return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", 'g'); | ||
}; | ||
ip.v4 = function (options) { | ||
return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), 'g'); | ||
}; | ||
ip.v6 = function (options) { | ||
return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), 'g'); | ||
}; | ||
var reg; | ||
var getUrlRegex = (function () { | ||
if (reg) { | ||
return reg; | ||
} | ||
var protocol = "(?:(?:[a-z]+:)?//)"; | ||
var auth = '(?:\\S+(?::\\S*)?@)?'; | ||
var ipSource = ip.v4({}).source; | ||
var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)"; | ||
var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"; | ||
var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))"; | ||
var port = '(?::\\d{2,5})?'; | ||
var path = '(?:[/?#][^\\s"]*)?'; | ||
var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipSource + "|" + host + domain + tld + ")" + port + path; | ||
reg = new RegExp("(?:^" + regex + "$)", 'i'); | ||
return reg; | ||
}); | ||
/* eslint max-len:0 */ | ||
@@ -422,3 +466,6 @@ | ||
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/, | ||
url: new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", 'i'), | ||
// url: new RegExp( | ||
// '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', | ||
// 'i', | ||
// ), | ||
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i | ||
@@ -467,3 +514,3 @@ }; | ||
url: function url(value) { | ||
return typeof value === 'string' && value.length <= 2048 && !!value.match(pattern$2.url); | ||
return typeof value === 'string' && value.length <= 2048 && !!value.match(getUrlRegex()); | ||
}, | ||
@@ -1289,3 +1336,3 @@ hex: function hex(value) { | ||
exports['default'] = Schema; | ||
exports["default"] = Schema; | ||
//# sourceMappingURL=index.js.map |
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
_extends = Object.assign ? Object.assign.bind() : function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
@@ -15,3 +15,2 @@ var source = arguments[i]; | ||
}; | ||
return _extends.apply(this, arguments); | ||
@@ -28,3 +27,3 @@ } | ||
function _getPrototypeOf(o) { | ||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { | ||
return o.__proto__ || Object.getPrototypeOf(o); | ||
@@ -36,7 +35,6 @@ }; | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
@@ -60,3 +58,3 @@ } | ||
if (_isNativeReflectConstruct()) { | ||
_construct = Reflect.construct; | ||
_construct = Reflect.construct.bind(); | ||
} else { | ||
@@ -411,2 +409,48 @@ _construct = function _construct(Parent, args, Class) { | ||
// https://github.com/kevva/url-regex/blob/master/index.js | ||
var word = '[a-fA-F\\d:]'; | ||
var b = function b(options) { | ||
return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : ''; | ||
}; | ||
var v4 = '(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}'; | ||
var v6seg = '[a-fA-F\\d]{1,4}'; | ||
var v6 = ("\n(?:\n(?:" + v6seg + ":){7}(?:" + v6seg + "|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:" + v6seg + ":){6}(?:" + v4 + "|:" + v6seg + "|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:" + v6seg + ":){5}(?::" + v4 + "|(?::" + v6seg + "){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:" + v6seg + ":){4}(?:(?::" + v6seg + "){0,1}:" + v4 + "|(?::" + v6seg + "){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:" + v6seg + ":){3}(?:(?::" + v6seg + "){0,2}:" + v4 + "|(?::" + v6seg + "){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:" + v6seg + ":){2}(?:(?::" + v6seg + "){0,3}:" + v4 + "|(?::" + v6seg + "){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:" + v6seg + ":){1}(?:(?::" + v6seg + "){0,4}:" + v4 + "|(?::" + v6seg + "){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::" + v6seg + "){0,5}:" + v4 + "|(?::" + v6seg + "){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim(); // Pre-compile only the exact regexes because adding a global flag make regexes stateful | ||
var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)"); | ||
var v4exact = new RegExp("^" + v4 + "$"); | ||
var v6exact = new RegExp("^" + v6 + "$"); | ||
var ip = function ip(options) { | ||
return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", 'g'); | ||
}; | ||
ip.v4 = function (options) { | ||
return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), 'g'); | ||
}; | ||
ip.v6 = function (options) { | ||
return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), 'g'); | ||
}; | ||
var reg; | ||
var getUrlRegex = (function () { | ||
if (reg) { | ||
return reg; | ||
} | ||
var protocol = "(?:(?:[a-z]+:)?//)"; | ||
var auth = '(?:\\S+(?::\\S*)?@)?'; | ||
var ipSource = ip.v4({}).source; | ||
var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)"; | ||
var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"; | ||
var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))"; | ||
var port = '(?::\\d{2,5})?'; | ||
var path = '(?:[/?#][^\\s"]*)?'; | ||
var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipSource + "|" + host + domain + tld + ")" + port + path; | ||
reg = new RegExp("(?:^" + regex + "$)", 'i'); | ||
return reg; | ||
}); | ||
/* eslint max-len:0 */ | ||
@@ -417,3 +461,6 @@ | ||
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/, | ||
url: new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", 'i'), | ||
// url: new RegExp( | ||
// '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', | ||
// 'i', | ||
// ), | ||
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i | ||
@@ -462,3 +509,3 @@ }; | ||
url: function url(value) { | ||
return typeof value === 'string' && value.length <= 2048 && !!value.match(pattern$2.url); | ||
return typeof value === 'string' && value.length <= 2048 && !!value.match(getUrlRegex()); | ||
}, | ||
@@ -465,0 +512,0 @@ hex: function hex(value) { |
{ | ||
"name": "async-validator", | ||
"description": "validate form asynchronous", | ||
"version": "4.1.1", | ||
"version": "4.2.3", | ||
"license": "MIT", | ||
@@ -42,2 +42,3 @@ "files": [ | ||
"prettier": "^1.11.1", | ||
"ts-node": "^10.8.1", | ||
"typescript": "^4.3.2" | ||
@@ -44,0 +45,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
283921
35
2461
17