Skip to content

Commit daab42b

Browse files
tux-tnMartin Beaudet
and
Martin Beaudet
authored
fix: multiple fixes related to alpha, tests and build (#1528)
Co-authored-by: Martin Beaudet <[email protected]>
1 parent 527950a commit daab42b

10 files changed

+69
-314
lines changed

.eslintignore

-2
This file was deleted.

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ package-lock.json
77
yarn.lock
88
/es
99
/lib
10+
validator.js
11+
validator.min.js
12+
index.js

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
sudo: false
21
language: node_js
32
node_js:
43
- stable

README.md

+6-6
Large diffs are not rendered by default.

index.js

-296
This file was deleted.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"build:es": "babel src -d es --env-name=es",
6868
"build:node": "babel src -d .",
6969
"build": "npm run build:browser && npm run build:node && npm run build:es",
70-
"pretest": "npm run lint && npm run build",
70+
"pretest": "npm run build && npm run lint",
7171
"test": "nyc mocha --require @babel/register --reporter dot",
7272
"test:ci": "nyc report --reporter=text-lcov"
7373
},

src/lib/alpha.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ export const alphanumeric = {
6868
export const decimal = {
6969
'en-US': '.',
7070
ar: '٫',
71-
fa: '٫',
7271
};
7372

7473

@@ -100,17 +99,16 @@ export const farsiLocales = [
10099

101100
for (let locale, i = 0; i < farsiLocales.length; i++) {
102101
locale = `fa-${farsiLocales[i]}`;
103-
alpha[locale] = alpha.fa;
104102
alphanumeric[locale] = alphanumeric.fa;
105-
decimal[locale] = decimal.fa;
103+
decimal[locale] = decimal.ar;
106104
}
107105

108106
// Source: https://en.wikipedia.org/wiki/Decimal_mark
109107
export const dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY'];
110108
export const commaDecimal = [
111-
'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-FR', 'id-ID', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO',
112-
'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin',
113-
'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN',
109+
'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-CA', 'fr-FR',
110+
'id-ID', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT',
111+
'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN',
114112
];
115113

116114
for (let i = 0; i < dotDecimal.length; i++) {
@@ -121,8 +119,8 @@ for (let i = 0; i < commaDecimal.length; i++) {
121119
decimal[commaDecimal[i]] = ',';
122120
}
123121

124-
// see #1455
125-
alpha['fa-IR'] = alpha['fa-IR'];
122+
alpha['fr-CA'] = alpha['fr-FR'];
123+
alphanumeric['fr-CA'] = alphanumeric['fr-FR'];
126124

127125
alpha['pt-BR'] = alpha['pt-PT'];
128126
alphanumeric['pt-BR'] = alphanumeric['pt-PT'];
@@ -132,3 +130,6 @@ decimal['pt-BR'] = decimal['pt-PT'];
132130
alpha['pl-Pl'] = alpha['pl-PL'];
133131
alphanumeric['pl-Pl'] = alphanumeric['pl-PL'];
134132
decimal['pl-Pl'] = decimal['pl-PL'];
133+
134+
// see #1455
135+
alpha['fa-AF'] = alpha.fa;

src/lib/isMobilePhone.js

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ const phones = {
116116

117117
// aliases
118118
phones['en-CA'] = phones['en-US'];
119+
phones['fr-CA'] = phones['en-CA'];
119120
phones['fr-BE'] = phones['nl-BE'];
120121
phones['zh-HK'] = phones['en-HK'];
121122
phones['zh-MO'] = phones['en-MO'];

test/sanitizers.js

+14
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,20 @@ describe('Sanitizers', () => {
268268
});
269269
});
270270

271+
it('should score passwords with default options', () => {
272+
test({
273+
sanitizer: 'isStrongPassword',
274+
expect: {
275+
abc: false,
276+
abcc: false,
277+
aBc: false,
278+
'Abc123!': false,
279+
'!@#$%^&*()': false,
280+
'abc123!@f#rA': true,
281+
},
282+
});
283+
});
284+
271285
it('should normalize an email based on domain', () => {
272286
test({
273287
sanitizer: 'normalizeEmail',

0 commit comments

Comments
 (0)