@bizy/core 19.14.4 → 19.14.6
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 +19 -31
- package/fesm2022/bizy-core.mjs.map +1 -1
- package/package.json +1 -1
package/fesm2022/bizy-core.mjs
CHANGED
|
@@ -2580,23 +2580,7 @@ class BizyFilterPipe {
|
|
|
2580
2580
|
return `__DATE__:${value.toISOString()}`;
|
|
2581
2581
|
return value;
|
|
2582
2582
|
}
|
|
2583
|
-
|
|
2584
|
-
const ordered = sortKeys(obj);
|
|
2585
|
-
return JSON.stringify(ordered, replacer);
|
|
2586
|
-
}
|
|
2587
|
-
function sortKeys(obj) {
|
|
2588
|
-
if (Array.isArray(obj)) {
|
|
2589
|
-
return obj.map(sortKeys);
|
|
2590
|
-
}
|
|
2591
|
-
else if (obj && typeof obj === 'object' && !(obj instanceof Date)) {
|
|
2592
|
-
return Object.keys(obj)
|
|
2593
|
-
.sort()
|
|
2594
|
-
.reduce((acc, key) => {
|
|
2595
|
-
acc[key] = sortKeys(obj[key]);
|
|
2596
|
-
return acc;
|
|
2597
|
-
}, {});
|
|
2598
|
-
}
|
|
2599
|
-
return obj;
|
|
2583
|
+
return JSON.stringify(obj, replacer);
|
|
2600
2584
|
}
|
|
2601
2585
|
function uniqueObjects(items) {
|
|
2602
2586
|
const seen = new Set();
|
|
@@ -4141,23 +4125,27 @@ class BizyValidatorService {
|
|
|
4141
4125
|
isUppercase = (value) => validator.isUppercase(value);
|
|
4142
4126
|
isMobilePhone = (data) => validator.isMobilePhone(data.value, data.locale);
|
|
4143
4127
|
isCUIT(cuit) {
|
|
4144
|
-
|
|
4145
|
-
const isCUIT = regex.test(String(cuit).toLowerCase());
|
|
4146
|
-
if (!isCUIT) {
|
|
4128
|
+
if (!cuit) {
|
|
4147
4129
|
return false;
|
|
4148
4130
|
}
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
return
|
|
4131
|
+
if (this.isString(cuit)) {
|
|
4132
|
+
cuit = cuit.replace(/[-]/g, '');
|
|
4133
|
+
}
|
|
4134
|
+
else {
|
|
4135
|
+
cuit = String(cuit);
|
|
4136
|
+
}
|
|
4137
|
+
// 20, 23, 24, 25, 26 y 27 Personas Físicas
|
|
4138
|
+
// 30, 33 y 34 Personas Jurídicas.
|
|
4139
|
+
if (!/^(20|23|24|25|26|27|30|33|34)\d{8}\d$/.test(cuit)) {
|
|
4140
|
+
return false;
|
|
4159
4141
|
}
|
|
4160
|
-
|
|
4142
|
+
const multipliers = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2];
|
|
4143
|
+
const digits = cuit.split('').map(Number);
|
|
4144
|
+
const checkDigit = digits[10];
|
|
4145
|
+
const sum = multipliers.reduce((acc, _multiplier, i) => acc + _multiplier * digits[i], 0);
|
|
4146
|
+
const mod11 = 11 - (sum % 11);
|
|
4147
|
+
const expectedDigit = mod11 === 11 ? 0 : mod11 === 10 ? 9 : mod11;
|
|
4148
|
+
return checkDigit === expectedDigit;
|
|
4161
4149
|
}
|
|
4162
4150
|
isDNI(dni) {
|
|
4163
4151
|
const regex = /(^[1-9]{1}[0-9]{7}$)/i;
|