@bizy/core 19.14.4 → 19.14.5
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/fesm2022/bizy-core.mjs +18 -14
- package/fesm2022/bizy-core.mjs.map +1 -1
- package/package.json +1 -1
package/fesm2022/bizy-core.mjs
CHANGED
|
@@ -4141,23 +4141,27 @@ class BizyValidatorService {
|
|
|
4141
4141
|
isUppercase = (value) => validator.isUppercase(value);
|
|
4142
4142
|
isMobilePhone = (data) => validator.isMobilePhone(data.value, data.locale);
|
|
4143
4143
|
isCUIT(cuit) {
|
|
4144
|
-
|
|
4145
|
-
const isCUIT = regex.test(String(cuit).toLowerCase());
|
|
4146
|
-
if (!isCUIT) {
|
|
4144
|
+
if (!cuit) {
|
|
4147
4145
|
return false;
|
|
4148
4146
|
}
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
return
|
|
4147
|
+
if (this.isString(cuit)) {
|
|
4148
|
+
cuit = cuit.replace(/[-]/g, '');
|
|
4149
|
+
}
|
|
4150
|
+
else {
|
|
4151
|
+
cuit = String(cuit);
|
|
4152
|
+
}
|
|
4153
|
+
// 20, 23, 24, 25, 26 y 27 Personas Físicas
|
|
4154
|
+
// 30, 33 y 34 Personas Jurídicas.
|
|
4155
|
+
if (!/^(20|23|24|25|26|27|30|33|34)\d{8}\d$/.test(cuit)) {
|
|
4156
|
+
return false;
|
|
4159
4157
|
}
|
|
4160
|
-
|
|
4158
|
+
const multipliers = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2];
|
|
4159
|
+
const digits = cuit.split('').map(Number);
|
|
4160
|
+
const checkDigit = digits[10];
|
|
4161
|
+
const sum = multipliers.reduce((acc, _multiplier, i) => acc + _multiplier * digits[i], 0);
|
|
4162
|
+
const mod11 = 11 - (sum % 11);
|
|
4163
|
+
const expectedDigit = mod11 === 11 ? 0 : mod11 === 10 ? 9 : mod11;
|
|
4164
|
+
return checkDigit === expectedDigit;
|
|
4161
4165
|
}
|
|
4162
4166
|
isDNI(dni) {
|
|
4163
4167
|
const regex = /(^[1-9]{1}[0-9]{7}$)/i;
|