Skip to content

Commit f492d89

Browse files
authored
13.1.17 (#1440)
ready for npm release
1 parent d5bbcf5 commit f492d89

23 files changed

+148
-52
lines changed

CHANGELOG.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,36 @@
1+
#### 13.1.17
2+
3+
- **New features**:
4+
- None
5+
- **Fixes and chores**:
6+
- [#1425](https://github.com/validatorjs/validator.js/pull/1425) fix validation for _userinfo_ part for `isURL` @heanzyzabala
7+
- [#1419](https://github.com/validatorjs/validator.js/pull/1419) fix `isBase32` and `isBase64` to validate empty strings properly @AberDerBart
8+
- [#1408](https://github.com/validatorjs/validator.js/pull/1408) tests for `isTaxId` @dspinellis
9+
- [#1397](https://github.com/validatorjs/validator.js/pull/1397) added `validate_length` option for `isURL` @tomgrossman
10+
- [#1383](https://github.com/validatorjs/validator.js/pull/1383) [#1428](https://github.com/validatorjs/validator.js/pull/1428) doc typos @0xflotus @timgates42
11+
- [#1376](https://github.com/validatorjs/validator.js/pull/1376) add missing tests and switch to Coverall @tux-tn
12+
- [#1373](https://github.com/validatorjs/validator.js/pull/1373) improve code coverage @ezkemboi
13+
- [#1357](https://github.com/validatorjs/validator.js/pull/1357) add Node v6 on build pipeline @profnandaa
14+
15+
- **New and Improved locales**:
16+
- [#1439](https://github.com/validatorjs/validator.js/pull/1439) @saidfagan
17+
- [#1420](https://github.com/validatorjs/validator.js/pull/1420) @icyice0217
18+
- [#1411](https://github.com/validatorjs/validator.js/pull/1411) @stinkymonkeyph
19+
- [#1394](https://github.com/validatorjs/validator.js/pull/1394) @heanzyzabala
20+
- [#1391](https://github.com/validatorjs/validator.js/pull/1391) @heanzyzabala
21+
- [#1388](https://github.com/validatorjs/validator.js/pull/1388) @stinkymonkeyph
22+
- [#1384](https://github.com/validatorjs/validator.js/pull/1384) @lorenzodb1
23+
- [#1371](https://github.com/validatorjs/validator.js/pull/1371) @rubiin
24+
- [#1370](https://github.com/validatorjs/validator.js/pull/1370) @rubiin
25+
- [#1367](https://github.com/validatorjs/validator.js/pull/1367) @rubiin
26+
- [#1356](https://github.com/validatorjs/validator.js/pull/1356) @MladenZeljic
27+
- [#1303](https://github.com/validatorjs/validator.js/pull/1301) @heathcliff-hu
28+
29+
130
#### 13.1.1
231

332
- Hotfix for a regex incompatibility in some browsers
4-
([#1355](https://github.com/chriso/validator.js/pull/1355))
33+
([#1355](https://github.com/chriso/validator.js/pull/1355)
534

635
#### 13.1.0
736

es/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ import blacklist from './lib/blacklist';
8686
import isWhitelisted from './lib/isWhitelisted';
8787
import normalizeEmail from './lib/normalizeEmail';
8888
import isSlug from './lib/isSlug';
89-
var version = '13.1.1';
89+
var version = '13.1.17';
9090
var validator = {
9191
version: version,
9292
toDate: toDate,

es/lib/alpha.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export var alpha = {
2626
'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,
2727
ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
2828
he: /^[א-ת]+$/,
29-
'fa-IR': /^['آابپتثجچهخدذرزژسشصضطظعغفقکگلمنوهی']+$/i
29+
fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i
3030
};
3131
export var alphanumeric = {
3232
'en-US': /^[0-9A-Z]+$/i,
@@ -56,11 +56,12 @@ export var alphanumeric = {
5656
'vi-VN': /^[0-9A-ZÀÁÃÂĂĐÈÉÊÌÍĨÒÓÕÔƠÙÚŨƯÝ]+$/i,
5757
ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,
5858
he: /^[0-9א-ת]+$/,
59-
'fa-IR': /^['0-9آابپتثجچهخدذرزژسشصضطظعغفقکگلمنوهی۱۲۳۴۵۶۷۸۹۰']+$/i
59+
fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i
6060
};
6161
export var decimal = {
6262
'en-US': '.',
63-
ar: '٫'
63+
ar: '٫',
64+
fa: '٫'
6465
};
6566
export var englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM'];
6667

@@ -79,18 +80,27 @@ for (var _locale, _i = 0; _i < arabicLocales.length; _i++) {
7980
alpha[_locale] = alpha.ar;
8081
alphanumeric[_locale] = alphanumeric.ar;
8182
decimal[_locale] = decimal.ar;
83+
}
84+
85+
export var farsiLocales = ['IR', 'AF'];
86+
87+
for (var _locale2, _i2 = 0; _i2 < farsiLocales.length; _i2++) {
88+
_locale2 = "fa-".concat(farsiLocales[_i2]);
89+
alpha[_locale2] = alpha.fa;
90+
alphanumeric[_locale2] = alphanumeric.fa;
91+
decimal[_locale2] = decimal.fa;
8292
} // Source: https://en.wikipedia.org/wiki/Decimal_mark
8393

8494

8595
export var dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY'];
8696
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'];
8797

88-
for (var _i2 = 0; _i2 < dotDecimal.length; _i2++) {
89-
decimal[dotDecimal[_i2]] = decimal['en-US'];
98+
for (var _i3 = 0; _i3 < dotDecimal.length; _i3++) {
99+
decimal[dotDecimal[_i3]] = decimal['en-US'];
90100
}
91101

92-
for (var _i3 = 0; _i3 < commaDecimal.length; _i3++) {
93-
decimal[commaDecimal[_i3]] = ',';
102+
for (var _i4 = 0; _i4 < commaDecimal.length; _i4++) {
103+
decimal[commaDecimal[_i4]] = ',';
94104
}
95105

96106
alpha['pt-BR'] = alpha['pt-PT'];

es/lib/isBase32.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default function isBase32(str) {
44
assertString(str);
55
var len = str.length;
66

7-
if (len > 0 && len % 8 === 0 && base32.test(str)) {
7+
if (len % 8 === 0 && base32.test(str)) {
88
return true;
99
}
1010

es/lib/isBase64.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assertString from './util/assertString';
22
import merge from './util/merge';
33
var notBase64 = /[^A-Z0-9+\/=]/i;
4-
var urlSafeBase64 = /^[A-Z0-9_\-]+$/i;
4+
var urlSafeBase64 = /^[A-Z0-9_\-]*$/i;
55
var defaultBase64Options = {
66
urlSafe: false
77
};
@@ -14,7 +14,7 @@ export default function isBase64(str, options) {
1414
return urlSafeBase64.test(str);
1515
}
1616

17-
if (!len || len % 4 !== 0 || notBase64.test(str)) {
17+
if (len % 4 !== 0 || notBase64.test(str)) {
1818
return false;
1919
}
2020

es/lib/isIBAN.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var ibanRegexThroughCountryCode = {
2525
DK: /^(DK[0-9]{2})\d{14}$/,
2626
DO: /^(DO[0-9]{2})[A-Z]{4}\d{20}$/,
2727
EE: /^(EE[0-9]{2})\d{16}$/,
28+
EG: /^(EG[0-9]{2})\d{25}$/,
2829
ES: /^(ES[0-9]{2})\d{20}$/,
2930
FI: /^(FI[0-9]{2})\d{14}$/,
3031
FO: /^(FO[0-9]{2})\d{14}$/,
@@ -74,6 +75,7 @@ var ibanRegexThroughCountryCode = {
7475
SI: /^(SI[0-9]{2})\d{15}$/,
7576
SK: /^(SK[0-9]{2})\d{20}$/,
7677
SM: /^(SM[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/,
78+
SV: /^(SV[0-9]{2})[A-Z0-9]{4}\d{20}$/,
7779
TL: /^(TL[0-9]{2})\d{19}$/,
7880
TN: /^(TN[0-9]{2})\d{20}$/,
7981
TR: /^(TR[0-9]{2})\d{5}[A-Z0-9]{17}$/,

es/lib/isMobilePhone.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ var phones = {
1414
'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/,
1515
'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/,
1616
'ar-TN': /^(\+?216)?[2459]\d{7}$/,
17+
'az-AZ': /^(\+994|0)(5[015]|7[07]|99)\d{7}$/,
1718
'bs-BA': /^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/,
1819
'be-BY': /^(\+?375)?(24|25|29|33|44)\d{7}$/,
1920
'bg-BG': /^(\+?359|0)?8[789]\d{7}$/,
2021
'bn-BD': /^(\+?880|0)1[13456789][0-9]{8}$/,
2122
'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,
2223
'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,
23-
'de-DE': /^(\+49)?0?1(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
24+
'de-DE': /^(\+49)?0?[1|3]([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,
2425
'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/,
2526
'de-CH': /^(\+41|0)(7[5-9])\d{1,7}$/,
2627
'el-GR': /^(\+?30|0)?(69\d{8})$/,
@@ -94,6 +95,7 @@ var phones = {
9495
'th-TH': /^(\+66|66|0)\d{9}$/,
9596
'tr-TR': /^(\+?90|0)?5\d{9}$/,
9697
'uk-UA': /^(\+?38|8)?0\d{9}$/,
98+
'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/,
9799
'vi-VN': /^(\+?84|0)((3([2-9]))|(5([2689]))|(7([0|6-9]))|(8([1-6|89]))|(9([0-9])))([0-9]{7})$/,
98100
'zh-CN': /^((\+|00)86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[012356789])[0-9]{8}$/,
99101
'zh-TW': /^(\+?886\-?|0)?9\d{8}$/

es/lib/isPostalCode.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var patterns = {
88
AD: /^AD\d{3}$/,
99
AT: fourDigit,
1010
AU: fourDigit,
11+
AZ: /^AZ\d{4}$/,
1112
BE: fourDigit,
1213
BG: fourDigit,
1314
BR: /^\d{5}-\d{3}$/,

es/lib/isURL.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require_valid_protocol - isURL will check if the URL's protocol is present in th
1010
protocols - valid protocols can be modified with this option
1111
require_host - if set as false isURL will not check if host is present in the URL
1212
allow_protocol_relative_urls - if set as true protocol relative URLs will be allowed
13+
validate_length - if set as false isURL will skip string length validation (IE maximum is 2083)
1314
1415
*/
1516

@@ -21,7 +22,8 @@ var default_url_options = {
2122
require_valid_protocol: true,
2223
allow_underscores: false,
2324
allow_trailing_dot: false,
24-
allow_protocol_relative_urls: false
25+
allow_protocol_relative_urls: false,
26+
validate_length: true
2527
};
2628
var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/;
2729

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

47-
if (!url || url.length >= 2083 || /[\s<>]/.test(url)) {
49+
if (!url || /[\s<>]/.test(url)) {
4850
return false;
4951
}
5052

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

5557
options = merge(options, default_url_options);
58+
59+
if (options.validate_length && url.length >= 2083) {
60+
return false;
61+
}
62+
5663
var protocol, auth, host, hostname, port, port_str, split, ipv6;
5764
split = url.split('#');
5865
url = split.shift();
@@ -98,7 +105,7 @@ export default function isURL(url, options) {
98105

99106
auth = split.shift();
100107

101-
if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) {
108+
if (auth.indexOf(':') === -1 || auth.indexOf(':') >= 0 && auth.split(':').length > 2) {
102109
return false;
103110
}
104111
}

es/lib/normalizeEmail.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,4 @@ export default function normalizeEmail(email, options) {
135135
}
136136

137137
return parts.join('@');
138-
}
138+
}

0 commit comments

Comments
 (0)