Skip to content

Commit

Permalink
regenerate
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Grosse-Holz committed Aug 20, 2020
1 parent a48221a commit 162d02a
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 41 deletions.
24 changes: 17 additions & 7 deletions es/lib/alpha.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export var alpha = {
'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
he: /^[א-ת]+$/,
'fa-IR': /^['آابپتثجچهخدذرزژسشصضطظعغفقکگلمنوهی']+$/i
fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i
};
export var alphanumeric = {
'en-US': /^[0-9A-Z]+$/i,
Expand Down Expand Up @@ -56,11 +56,12 @@ export var alphanumeric = {
'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
he: /^[0-9א-ת]+$/,
'fa-IR': /^['0-9آابپتثجچهخدذرزژسشصضطظعغفقکگلمنوهی۱۲۳۴۵۶۷۸۹۰']+$/i
fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i
};
export var decimal = {
'en-US': '.',
ar: '٫'
ar: '٫',
fa: '٫'
};
export var englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];

Expand All @@ -79,18 +80,27 @@ for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
alpha[_locale] = alpha.ar;
alphanumeric[_locale] = alphanumeric.ar;
decimal[_locale] = decimal.ar;
}

export var farsiLocales = ['IR', 'AF'];

for (var _locale2, _i2 = 0; _i2 < farsiLocales.length; _i2++) {
_locale2 = "fa-".concat(farsiLocales[_i2]);
alpha[_locale2] = alpha.fa;
alphanumeric[_locale2] = alphanumeric.fa;
decimal[_locale2] = decimal.fa;
} // Source: https://en.wikipedia.org/wiki/Decimal_mark


export var dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY'];
export var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'];

for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) {
decimal[dotDecimal[_i2]] = decimal['en-US'];
for (var _i3 = 0; _i3 < dotDecimal.length; _i3++) {
decimal[dotDecimal[_i3]] = decimal['en-US'];
}

for (var _i3 = 0; _i3 < commaDecimal.length; _i3++) {
decimal[commaDecimal[_i3]] = ',';
for (var _i4 = 0; _i4 < commaDecimal.length; _i4++) {
decimal[commaDecimal[_i4]] = ',';
}

alpha['pt-BR'] = alpha['pt-PT'];
Expand Down
2 changes: 1 addition & 1 deletion es/lib/isBase32.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default function isBase32(str) {
assertString(str);
var len = str.length;

if (len > 0 && len % 8 === 0 && base32.test(str)) {
if (len % 8 === 0 && base32.test(str)) {
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions es/lib/isBase64.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import assertString from './util/assertString';
import merge from './util/merge';
var notBase64 = /[^A-Z0-9+\/=]/i;
var urlSafeBase64 = /^[A-Z0-9_\-]+$/i;
var urlSafeBase64 = /^[A-Z0-9_\-]*$/i;
var defaultBase64Options = {
urlSafe: false
};
Expand All @@ -14,7 +14,7 @@ export default function isBase64(str, options) {
return urlSafeBase64.test(str);
}

if (!len || len % 4 !== 0 || notBase64.test(str)) {
if (len % 4 !== 0 || notBase64.test(str)) {
return false;
}

Expand Down
2 changes: 2 additions & 0 deletions es/lib/isIBAN.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var ibanRegexThroughCountryCode = {
DK: /^(DK[0-9]{2})\d{14}$/,
DO: /^(DO[0-9]{2})[A-Z]{4}\d{20}$/,
EE: /^(EE[0-9]{2})\d{16}$/,
EG: /^(EG[0-9]{2})\d{25}$/,
ES: /^(ES[0-9]{2})\d{20}$/,
FI: /^(FI[0-9]{2})\d{14}$/,
FO: /^(FO[0-9]{2})\d{14}$/,
Expand Down Expand Up @@ -74,6 +75,7 @@ var ibanRegexThroughCountryCode = {
SI: /^(SI[0-9]{2})\d{15}$/,
SK: /^(SK[0-9]{2})\d{20}$/,
SM: /^(SM[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/,
SV: /^(SV[0-9]{2})[A-Z0-9]{4}\d{20}$/,
TL: /^(TL[0-9]{2})\d{19}$/,
TN: /^(TN[0-9]{2})\d{20}$/,
TR: /^(TR[0-9]{2})\d{5}[A-Z0-9]{17}$/,
Expand Down
2 changes: 1 addition & 1 deletion es/lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var phones = {
'bn-BD': /^(\+?880|0)1[13456789][0-9]{8}$/,
'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
'de-DE': /^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
'de-DE': /^(\+49)?0?[1|3]([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
'de-CH': /^(\+41|0)(7[5-9])\d{1,7}$/,
'el-GR': /^(\+?30|0)?(69\d{8})$/,
Expand Down
11 changes: 9 additions & 2 deletions es/lib/isURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require_valid_protocol - isURL will check if the URL's protocol is present in th
protocols - valid protocols can be modified with this option
require_host - if set as false isURL will not check if host is present in the URL
allow_protocol_relative_urls - if set as true protocol relative URLs will be allowed
validate_length - if set as false isURL will skip string length validation (IE maximum is 2083)
*/

Expand All @@ -21,7 +22,8 @@ var default_url_options = {
require_valid_protocol: true,
allow_underscores: false,
allow_trailing_dot: false,
allow_protocol_relative_urls: false
allow_protocol_relative_urls: false,
validate_length: true
};
var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/;

Expand All @@ -44,7 +46,7 @@ function checkHost(host, matches) {
export default function isURL(url, options) {
assertString(url);

if (!url || url.length >= 2083 || /[\s<>]/.test(url)) {
if (!url || /[\s<>]/.test(url)) {
return false;
}

Expand All @@ -53,6 +55,11 @@ export default function isURL(url, options) {
}

options = merge(options, default_url_options);

if (options.validate_length && url.length >= 2083) {
return false;
}

var protocol, auth, host, hostname, port, port_str, split, ipv6;
split = url.split('#');
url = split.shift();
Expand Down
27 changes: 19 additions & 8 deletions lib/alpha.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.commaDecimal = exports.dotDecimal = exports.arabicLocales = exports.englishLocales = exports.decimal = exports.alphanumeric = exports.alpha = void 0;
exports.commaDecimal = exports.dotDecimal = exports.farsiLocales = exports.arabicLocales = exports.englishLocales = exports.decimal = exports.alphanumeric = exports.alpha = void 0;
var alpha = {
'en-US': /^[A-Z]+$/i,
'bg-BG': /^[А-Я]+$/i,
Expand Down Expand Up @@ -32,7 +32,7 @@ var alpha = {
'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
he: /^[א-ת]+$/,
'fa-IR': /^['آابپتثجچهخدذرزژسشصضطظعغفقکگلمنوهی']+$/i
fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i
};
exports.alpha = alpha;
var alphanumeric = {
Expand Down Expand Up @@ -63,12 +63,13 @@ var alphanumeric = {
'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
he: /^[0-9א-ת]+$/,
'fa-IR': /^['0-9آابپتثجچهخدذرزژسشصضطظعغفقکگلمنوهی۱۲۳۴۵۶۷۸۹۰']+$/i
fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i
};
exports.alphanumeric = alphanumeric;
var decimal = {
'en-US': '.',
ar: '٫'
ar: '٫',
fa: '٫'
};
exports.decimal = decimal;
var englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];
Expand All @@ -90,6 +91,16 @@ for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
alpha[_locale] = alpha.ar;
alphanumeric[_locale] = alphanumeric.ar;
decimal[_locale] = decimal.ar;
}

var farsiLocales = ['IR', 'AF'];
exports.farsiLocales = farsiLocales;

for (var _locale2, _i2 = 0; _i2 < farsiLocales.length; _i2++) {
_locale2 = "fa-".concat(farsiLocales[_i2]);
alpha[_locale2] = alpha.fa;
alphanumeric[_locale2] = alphanumeric.fa;
decimal[_locale2] = decimal.fa;
} // Source: https://en.wikipedia.org/wiki/Decimal_mark


Expand All @@ -98,12 +109,12 @@ exports.dotDecimal = dotDecimal;
var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-FR', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN'];
exports.commaDecimal = commaDecimal;

for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) {
decimal[dotDecimal[_i2]] = decimal['en-US'];
for (var _i3 = 0; _i3 < dotDecimal.length; _i3++) {
decimal[dotDecimal[_i3]] = decimal['en-US'];
}

for (var _i3 = 0; _i3 < commaDecimal.length; _i3++) {
decimal[commaDecimal[_i3]] = ',';
for (var _i4 = 0; _i4 < commaDecimal.length; _i4++) {
decimal[commaDecimal[_i4]] = ',';
}

alpha['pt-BR'] = alpha['pt-PT'];
Expand Down
2 changes: 1 addition & 1 deletion lib/isBase32.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function isBase32(str) {
(0, _assertString.default)(str);
var len = str.length;

if (len > 0 && len % 8 === 0 && base32.test(str)) {
if (len % 8 === 0 && base32.test(str)) {
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/isBase64.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var _merge = _interopRequireDefault(require("./util/merge"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var notBase64 = /[^A-Z0-9+\/=]/i;
var urlSafeBase64 = /^[A-Z0-9_\-]+$/i;
var urlSafeBase64 = /^[A-Z0-9_\-]*$/i;
var defaultBase64Options = {
urlSafe: false
};
Expand All @@ -26,7 +26,7 @@ function isBase64(str, options) {
return urlSafeBase64.test(str);
}

if (!len || len % 4 !== 0 || notBase64.test(str)) {
if (len % 4 !== 0 || notBase64.test(str)) {
return false;
}

Expand Down
2 changes: 2 additions & 0 deletions lib/isIBAN.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var ibanRegexThroughCountryCode = {
DK: /^(DK[0-9]{2})\d{14}$/,
DO: /^(DO[0-9]{2})[A-Z]{4}\d{20}$/,
EE: /^(EE[0-9]{2})\d{16}$/,
EG: /^(EG[0-9]{2})\d{25}$/,
ES: /^(ES[0-9]{2})\d{20}$/,
FI: /^(FI[0-9]{2})\d{14}$/,
FO: /^(FO[0-9]{2})\d{14}$/,
Expand Down Expand Up @@ -83,6 +84,7 @@ var ibanRegexThroughCountryCode = {
SI: /^(SI[0-9]{2})\d{15}$/,
SK: /^(SK[0-9]{2})\d{20}$/,
SM: /^(SM[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/,
SV: /^(SV[0-9]{2})[A-Z0-9]{4}\d{20}$/,
TL: /^(TL[0-9]{2})\d{19}$/,
TN: /^(TN[0-9]{2})\d{20}$/,
TR: /^(TR[0-9]{2})\d{5}[A-Z0-9]{17}$/,
Expand Down
2 changes: 1 addition & 1 deletion lib/isMobilePhone.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var phones = {
'bn-BD': /^(\+?880|0)1[13456789][0-9]{8}$/,
'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
'de-DE': /^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
'de-DE': /^(\+49)?0?[1|3]([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
'de-CH': /^(\+41|0)(7[5-9])\d{1,7}$/,
'el-GR': /^(\+?30|0)?(69\d{8})$/,
Expand Down
11 changes: 9 additions & 2 deletions lib/isURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ require_valid_protocol - isURL will check if the URL's protocol is present in th
protocols - valid protocols can be modified with this option
require_host - if set as false isURL will not check if host is present in the URL
allow_protocol_relative_urls - if set as true protocol relative URLs will be allowed
validate_length - if set as false isURL will skip string length validation (IE maximum is 2083)
*/
var default_url_options = {
Expand All @@ -33,7 +34,8 @@ var default_url_options = {
require_valid_protocol: true,
allow_underscores: false,
allow_trailing_dot: false,
allow_protocol_relative_urls: false
allow_protocol_relative_urls: false,
validate_length: true
};
var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/;

Expand All @@ -56,7 +58,7 @@ function checkHost(host, matches) {
function isURL(url, options) {
(0, _assertString.default)(url);

if (!url || url.length >= 2083 || /[\s<>]/.test(url)) {
if (!url || /[\s<>]/.test(url)) {
return false;
}

Expand All @@ -65,6 +67,11 @@ function isURL(url, options) {
}

options = (0, _merge.default)(options, default_url_options);

if (options.validate_length && url.length >= 2083) {
return false;
}

var protocol, auth, host, hostname, port, port_str, split, ipv6;
split = url.split('#');
url = split.shift();
Expand Down
Loading

0 comments on commit 162d02a

Please sign in to comment.