@stbmoz-onboarding/core 1.0.22 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Utilities/contractTypes.js +9 -3
- package/Utilities/idDocuments.js +4 -4
- package/Utilities/maritalStatus.js +10 -10
- package/Utilities/marriageRegime.js +14 -8
- package/Utilities/provinces.js +22 -22
- package/Validations/index.js +145 -174
- package/package.json +1 -1
|
@@ -6,15 +6,21 @@ export const contractRegimes = [
|
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
8
|
value: "DETERMINATED",
|
|
9
|
+
pt: "Determinado",
|
|
10
|
+
en: "Determinated"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: "TEMPORARY",
|
|
9
14
|
pt: "Temporário",
|
|
10
15
|
en: "Temporary"
|
|
11
|
-
}
|
|
16
|
+
}
|
|
12
17
|
]
|
|
13
18
|
|
|
14
19
|
|
|
15
20
|
export const contractRegime = {
|
|
16
21
|
indeterminated: "INDETERMINATED",
|
|
17
|
-
determinated: "DETERMINATED"
|
|
22
|
+
determinated: "DETERMINATED",
|
|
23
|
+
temporary: "TEMPORARY"
|
|
18
24
|
}
|
|
19
25
|
|
|
20
|
-
export default contractRegimes
|
|
26
|
+
export default contractRegimes
|
package/Utilities/idDocuments.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export const idDocuments = [
|
|
2
2
|
{
|
|
3
|
-
value:
|
|
3
|
+
value: 2,
|
|
4
4
|
pt: "Bilhete de Identidade",
|
|
5
5
|
en: "Identity card"
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
|
-
value:
|
|
8
|
+
value: 1,
|
|
9
9
|
pt: "Passaporte",
|
|
10
10
|
en: "Passport"
|
|
11
11
|
}
|
|
12
12
|
];
|
|
13
13
|
|
|
14
14
|
export const idDocument = {
|
|
15
|
-
id:
|
|
16
|
-
passport:
|
|
15
|
+
id: 2,
|
|
16
|
+
passport: 1
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export default idDocuments
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const maritalStatuses = [
|
|
2
2
|
{
|
|
3
|
-
value:
|
|
3
|
+
value: 1,
|
|
4
4
|
pt: {
|
|
5
5
|
MALE: 'Solteiro',
|
|
6
6
|
FEMALE: 'Solteira',
|
|
@@ -12,7 +12,7 @@ export const maritalStatuses = [
|
|
|
12
12
|
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
value:
|
|
15
|
+
value: 2,
|
|
16
16
|
pt: {
|
|
17
17
|
MALE: 'Casado',
|
|
18
18
|
FEMALE: 'Casada',
|
|
@@ -23,7 +23,7 @@ export const maritalStatuses = [
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
value:
|
|
26
|
+
value: 3,
|
|
27
27
|
pt: {
|
|
28
28
|
MALE: 'Divorciado',
|
|
29
29
|
FEMALE: 'Divorciada'
|
|
@@ -34,23 +34,23 @@ export const maritalStatuses = [
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
value:
|
|
37
|
+
value: 4,
|
|
38
38
|
pt: {
|
|
39
39
|
MALE: 'Viúvo',
|
|
40
40
|
FEMALE: 'Viúva'
|
|
41
41
|
},
|
|
42
42
|
en: {
|
|
43
|
-
MALE: '
|
|
43
|
+
MALE: 'Widower',
|
|
44
44
|
FEMALE: 'Widow'
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
]
|
|
48
48
|
|
|
49
49
|
export const maritalStatus = {
|
|
50
|
-
single:
|
|
51
|
-
married:
|
|
52
|
-
divorced:
|
|
53
|
-
widow:
|
|
50
|
+
single: 1,
|
|
51
|
+
married: 2,
|
|
52
|
+
divorced: 3,
|
|
53
|
+
widow: 4
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export default maritalStatuses
|
|
56
|
+
export default maritalStatuses
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
export const marriageRegimes = [
|
|
2
2
|
{
|
|
3
|
-
value:
|
|
3
|
+
value: 1,
|
|
4
4
|
pt: "Comunhão de bens",
|
|
5
|
-
en: "
|
|
5
|
+
en: "Community of property"
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
|
-
value:
|
|
8
|
+
value: 2,
|
|
9
9
|
pt: "Com acúmulo de bens",
|
|
10
10
|
en: "ANC-WITH ACCRUAL"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
value:
|
|
13
|
+
value: 3,
|
|
14
14
|
pt: "Sem acúmulo de bens",
|
|
15
|
-
en: "ANC-
|
|
15
|
+
en: "ANC-WITHOUT ACCRUAL"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: 9,
|
|
19
|
+
pt: "Desconhecido",
|
|
20
|
+
en: "Unknown"
|
|
16
21
|
}
|
|
17
22
|
]
|
|
18
23
|
|
|
19
24
|
export const marriageRegime = {
|
|
20
|
-
communityProperty:
|
|
21
|
-
ancWithAccrual:
|
|
22
|
-
ancwithoutAccrual:
|
|
25
|
+
communityProperty: 1,
|
|
26
|
+
ancWithAccrual: 2,
|
|
27
|
+
ancwithoutAccrual: 3,
|
|
28
|
+
unknown: 9
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
export default marriageRegime
|
package/Utilities/provinces.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
const provinces = [
|
|
2
2
|
{
|
|
3
|
-
value: "
|
|
3
|
+
value: "110000",
|
|
4
4
|
pt: "Maputo Cidade",
|
|
5
5
|
en: "Maputo City"
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
|
-
value: "
|
|
8
|
+
value: "100000",
|
|
9
9
|
pt: "Maputo Província",
|
|
10
|
-
en: "Maputo
|
|
10
|
+
en: "Maputo Province"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
value: "
|
|
13
|
+
value: "90000",
|
|
14
14
|
pt: "Gaza",
|
|
15
|
-
en: "
|
|
15
|
+
en: "Gaza"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
value: "
|
|
18
|
+
value: "80000",
|
|
19
19
|
pt: "Inhambane",
|
|
20
|
-
en: "
|
|
20
|
+
en: "Inhambane"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
value: "
|
|
23
|
+
value: "70000",
|
|
24
24
|
pt: "Sofala",
|
|
25
|
-
en: "
|
|
25
|
+
en: "Sofala"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
|
-
value: "
|
|
28
|
+
value: "60000",
|
|
29
29
|
pt: "Manica",
|
|
30
|
-
en: "
|
|
30
|
+
en: "Manica"
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
value: "
|
|
33
|
+
value: "50000",
|
|
34
34
|
pt: "Tete",
|
|
35
|
-
en: "
|
|
35
|
+
en: "Tete"
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
|
-
value: "
|
|
38
|
+
value: "40000",
|
|
39
39
|
pt: "Zambézia",
|
|
40
|
-
en: "
|
|
40
|
+
en: "Zambezia"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
value: "
|
|
43
|
+
value: "30000",
|
|
44
44
|
pt: "Nampula",
|
|
45
|
-
en: "
|
|
45
|
+
en: "Nampula"
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
value: "
|
|
48
|
+
value: "20000",
|
|
49
49
|
pt: "Cabo Delgado",
|
|
50
|
-
en: "
|
|
50
|
+
en: "Cabo Delgado"
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
value: "
|
|
53
|
+
value: "10000",
|
|
54
54
|
pt: "Niassa",
|
|
55
|
-
en: "
|
|
56
|
-
}
|
|
55
|
+
en: "Niassa"
|
|
56
|
+
}
|
|
57
57
|
]
|
|
58
58
|
|
|
59
59
|
export default provinces
|
package/Validations/index.js
CHANGED
|
@@ -3,242 +3,213 @@ const AllowedPrefixes = ['25884', '25885', '25886', '25887', '25882', '25883']
|
|
|
3
3
|
|
|
4
4
|
// Check is a guiven email is valid
|
|
5
5
|
export const isEmailValid = (email) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
if (/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(email)) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
//Check is password is strong
|
|
12
12
|
export const isPasswordStrong = (password) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
if (/[a-z]/.test(password) && // checks for a-z
|
|
14
|
+
/[0-9]/.test(password) && // checks for 0-9
|
|
15
|
+
/\W|_/.test(password) && // checks for special char
|
|
16
|
+
password.length >= 8 //Checks if is password 8 chars long
|
|
17
|
+
) {
|
|
18
|
+
return true
|
|
19
|
+
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const isSameAs = (value1, value2) => {
|
|
23
|
-
|
|
24
|
-
return true
|
|
25
|
-
}
|
|
23
|
+
if (value1 === value2) return true
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
//Checks if string containes white space
|
|
29
27
|
export const containesWhiteSpace = (string) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return true
|
|
33
|
-
}
|
|
28
|
+
string = string.replace(/(\r\n|\n|\r)/gm, " ");
|
|
29
|
+
if (string.includes(' ')) return true
|
|
34
30
|
}
|
|
35
31
|
|
|
36
|
-
|
|
37
32
|
//Checks if value is greather then
|
|
38
33
|
export const isMinValue = (minValue, value2ToCheck) => {
|
|
39
|
-
|
|
40
|
-
return true
|
|
41
|
-
}
|
|
34
|
+
if (minValue <= value2ToCheck) return true
|
|
42
35
|
}
|
|
43
36
|
|
|
44
|
-
|
|
45
37
|
export const isMinLength = (value, length) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return true
|
|
51
|
-
}
|
|
38
|
+
let stringValue = value.toString()
|
|
39
|
+
stringValue = value.toLowerCase()
|
|
40
|
+
stringValue = stringValue.split('')
|
|
41
|
+
if (stringValue.length >= length) return true
|
|
52
42
|
}
|
|
53
43
|
|
|
54
44
|
export const isAboveMaxLength = (value, length) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return true
|
|
60
|
-
}
|
|
45
|
+
let stringValue = value.toString()
|
|
46
|
+
stringValue = stringValue.toLowerCase()
|
|
47
|
+
stringValue = stringValue.split('')
|
|
48
|
+
if (stringValue.length > length) return true
|
|
61
49
|
}
|
|
62
50
|
|
|
63
51
|
export const isLength = (value, length) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return true
|
|
69
|
-
}
|
|
52
|
+
let stringValue = value.toString()
|
|
53
|
+
stringValue = stringValue.toLowerCase()
|
|
54
|
+
stringValue = stringValue.split('')
|
|
55
|
+
if (stringValue.length === length) return true
|
|
70
56
|
}
|
|
71
57
|
|
|
72
|
-
|
|
73
58
|
export const allowedCharsOnly = (stringToTest, charSet) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
59
|
+
try {
|
|
60
|
+
let stringToCheck = stringToTest.toString()
|
|
61
|
+
const dictionary = charSet.split('')
|
|
62
|
+
|
|
63
|
+
if (stringToCheck.length > 0) {
|
|
64
|
+
let phrase = stringToCheck.toLowerCase()
|
|
65
|
+
phrase = phrase.replace(/(\r\n|\n|\r)/gm, " ");
|
|
66
|
+
phrase = phrase.split('');
|
|
67
|
+
return !(phrase.some(function (item) {
|
|
68
|
+
if (!dictionary.includes(item)) {
|
|
69
|
+
return true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
))
|
|
85
73
|
}
|
|
86
|
-
}
|
|
87
|
-
))
|
|
88
|
-
}
|
|
89
74
|
} catch (e) {
|
|
90
|
-
|
|
75
|
+
return false
|
|
91
76
|
}
|
|
92
77
|
}
|
|
93
78
|
|
|
94
79
|
export const startsWith = (toBeChecked, startsWithThis) => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return true
|
|
98
|
-
}
|
|
80
|
+
toBeChecked = toBeChecked.toString()
|
|
81
|
+
if (toBeChecked.startsWith(startsWithThis)) return true
|
|
99
82
|
}
|
|
100
83
|
|
|
101
84
|
export const isInteger = (number) => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return true
|
|
105
|
-
}
|
|
85
|
+
number = Number(number)
|
|
86
|
+
if (Number.isInteger(number)) return true
|
|
106
87
|
}
|
|
107
88
|
|
|
108
89
|
export const isIn = (value, optionsArray) => {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
90
|
+
try {
|
|
91
|
+
return optionsArray.includes(value)
|
|
92
|
+
} catch (error) {
|
|
93
|
+
return false
|
|
94
|
+
}
|
|
114
95
|
}
|
|
115
96
|
|
|
116
|
-
|
|
117
97
|
export const isContactValid = (number) => {
|
|
118
|
-
|
|
119
|
-
return false
|
|
120
|
-
} else {
|
|
121
|
-
try {
|
|
122
|
-
const numb = String(number)
|
|
123
|
-
if (/^([0-9]{12})$/.test(number)) {
|
|
124
|
-
const prefix = numb.slice(0, 5)
|
|
125
|
-
|
|
126
|
-
if (isIn(prefix, AllowedPrefixes)) {
|
|
127
|
-
return true
|
|
128
|
-
}
|
|
98
|
+
if (!number) {
|
|
129
99
|
return false
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
100
|
+
} else {
|
|
101
|
+
try {
|
|
102
|
+
const numb = String(number)
|
|
103
|
+
if (/^([0-9]{12})$/.test(number)) {
|
|
104
|
+
const prefix = numb.slice(0, 5)
|
|
105
|
+
|
|
106
|
+
if (isIn(prefix, AllowedPrefixes)) {
|
|
107
|
+
return true
|
|
108
|
+
}
|
|
109
|
+
return false
|
|
110
|
+
} else {
|
|
111
|
+
return false
|
|
112
|
+
}
|
|
113
|
+
} catch (e) {
|
|
114
|
+
return false
|
|
115
|
+
}
|
|
135
116
|
}
|
|
136
|
-
}
|
|
137
117
|
}
|
|
138
118
|
|
|
139
|
-
|
|
140
119
|
export const WordsCount = (str) => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
120
|
+
try {
|
|
121
|
+
if (str) {
|
|
122
|
+
str = str.replace(/(^\s*)|(\s*$)/gi, "");
|
|
123
|
+
str = str.replace(/[ ]{2,}/gi, " ");
|
|
124
|
+
str = str.replace(/\n /, "\n");
|
|
125
|
+
return str.split(' ').length;
|
|
126
|
+
} else {
|
|
127
|
+
return 0
|
|
128
|
+
}
|
|
129
|
+
} catch (error) {
|
|
130
|
+
return 0
|
|
149
131
|
}
|
|
150
|
-
} catch (error) {
|
|
151
|
-
return 0
|
|
152
|
-
}
|
|
153
132
|
}
|
|
154
133
|
|
|
155
|
-
|
|
156
134
|
export function isMinor(dateOfBirth, ageLimit) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
135
|
+
let today = new Date()
|
|
136
|
+
let birthDate = new Date(dateOfBirth)
|
|
137
|
+
let age = today.getFullYear() - birthDate.getFullYear()
|
|
138
|
+
let m = today.getMonth() - birthDate.getMonth()
|
|
139
|
+
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
|
|
140
|
+
age--
|
|
141
|
+
}
|
|
142
|
+
if (age >= ageLimit) return true
|
|
165
143
|
}
|
|
166
144
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
145
|
+
export function isBIValid(BINumber) {
|
|
146
|
+
if (/^([0-9]{12})+([A-Z]\b)$/.test(BINumber)) {
|
|
147
|
+
return true
|
|
148
|
+
} else {
|
|
149
|
+
return false
|
|
150
|
+
}
|
|
174
151
|
}
|
|
175
152
|
|
|
176
|
-
export function isValidCertificateNumber(number){
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
153
|
+
export function isValidCertificateNumber(number) {
|
|
154
|
+
try {
|
|
155
|
+
if (/^([0-9]{9})$/.test(number)) return true
|
|
156
|
+
throw new Error()
|
|
157
|
+
} catch (error) {
|
|
158
|
+
return false
|
|
180
159
|
}
|
|
181
|
-
throw new Error()
|
|
182
|
-
} catch (error) {
|
|
183
|
-
return false
|
|
184
|
-
}
|
|
185
160
|
}
|
|
186
161
|
|
|
187
|
-
|
|
188
162
|
export function isPDF(filedata) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return false
|
|
163
|
+
let aux = filedata.name.split(".")
|
|
164
|
+
const extention = aux[aux.length - 1]
|
|
165
|
+
if (extention == "pdf" || extention == "PDF" && filedata.type == "application/pdf") {
|
|
166
|
+
return true
|
|
167
|
+
}
|
|
168
|
+
return false
|
|
196
169
|
}
|
|
197
170
|
|
|
198
|
-
|
|
199
|
-
|
|
200
171
|
export function isValidNuit(nuit) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
172
|
+
try {
|
|
173
|
+
const nuitNumber = nuit.toString()
|
|
174
|
+
if (nuitNumber.length != 9) {
|
|
175
|
+
return false
|
|
176
|
+
}
|
|
177
|
+
let a = parseInt(nuitNumber.substr(0, 1))
|
|
178
|
+
let b = parseInt(nuitNumber.substr(1, 1))
|
|
179
|
+
let c = parseInt(nuitNumber.substr(2, 1))
|
|
180
|
+
let d = parseInt(nuitNumber.substr(3, 1))
|
|
181
|
+
let e = parseInt(nuitNumber.substr(4, 1))
|
|
182
|
+
let f = parseInt(nuitNumber.substr(5, 1))
|
|
183
|
+
let g = parseInt(nuitNumber.substr(6, 1))
|
|
184
|
+
let h = parseInt(nuitNumber.substr(7, 1))
|
|
185
|
+
let checkDigit = parseInt(nuitNumber.substr(8, 1))
|
|
186
|
+
|
|
187
|
+
a = a * 3
|
|
188
|
+
b = b * 2
|
|
189
|
+
c = c * 7
|
|
190
|
+
d = d * 6
|
|
191
|
+
e = e * 5
|
|
192
|
+
f = f * 4
|
|
193
|
+
g = g * 3
|
|
194
|
+
h = h * 2
|
|
195
|
+
|
|
196
|
+
const digitsSum = a + b + c + d + e + f + g + h
|
|
197
|
+
const digitsMOD = digitsSum % 11
|
|
198
|
+
|
|
199
|
+
if (digitsMOD == 0 || digitsMOD == 1) {
|
|
200
|
+
|
|
201
|
+
if (digitsMOD == checkDigit) {
|
|
202
|
+
return true
|
|
203
|
+
}
|
|
204
|
+
} else {
|
|
205
|
+
const result = 11 - digitsMOD
|
|
206
|
+
if (result == checkDigit) {
|
|
207
|
+
return true
|
|
208
|
+
|
|
209
|
+
}
|
|
210
|
+
}
|
|
205
211
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
let c = parseInt(nuitNumber.substr(2, 1))
|
|
209
|
-
let d = parseInt(nuitNumber.substr(3, 1))
|
|
210
|
-
let e = parseInt(nuitNumber.substr(4, 1))
|
|
211
|
-
let f = parseInt(nuitNumber.substr(5, 1))
|
|
212
|
-
let g = parseInt(nuitNumber.substr(6, 1))
|
|
213
|
-
let h = parseInt(nuitNumber.substr(7, 1))
|
|
214
|
-
let checkDigit = parseInt(nuitNumber.substr(8, 1))
|
|
215
|
-
|
|
216
|
-
a = a * 3
|
|
217
|
-
b = b * 2
|
|
218
|
-
c = c * 7
|
|
219
|
-
d = d * 6
|
|
220
|
-
e = e * 5
|
|
221
|
-
f = f * 4
|
|
222
|
-
g = g * 3
|
|
223
|
-
h = h * 2
|
|
224
|
-
|
|
225
|
-
const digitsSum = a + b + c + d + e + f + g + h
|
|
226
|
-
const digitsMOD = digitsSum % 11
|
|
227
|
-
|
|
228
|
-
if (digitsMOD == 0 || digitsMOD == 1) {
|
|
229
|
-
|
|
230
|
-
if (digitsMOD == checkDigit) {
|
|
231
|
-
return true
|
|
232
|
-
}
|
|
233
|
-
} else {
|
|
234
|
-
const result = 11 - digitsMOD
|
|
235
|
-
if (result == checkDigit) {
|
|
236
|
-
return true
|
|
237
|
-
|
|
238
|
-
}
|
|
212
|
+
catch (err) {
|
|
213
|
+
return false
|
|
239
214
|
}
|
|
240
|
-
}
|
|
241
|
-
catch (err) {
|
|
242
|
-
return false
|
|
243
|
-
}
|
|
244
215
|
}
|