@contrail/util 1.1.7-0 → 1.1.7
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.
|
@@ -28,17 +28,17 @@ function determineChangesIfEqual(target, priorSourceValues, newSourceValues, pro
|
|
|
28
28
|
}
|
|
29
29
|
exports.determineChangesIfEqual = determineChangesIfEqual;
|
|
30
30
|
function areItemPropertyValuesEqual(property, itemOne, itemTwo) {
|
|
31
|
-
var _a, _b;
|
|
31
|
+
var _a, _b, _c, _d;
|
|
32
32
|
const propertyKey = getPropertyKey(property);
|
|
33
|
-
const propertyValueOne = itemOne[propertyKey];
|
|
34
|
-
const propertyValueTwo = itemTwo[propertyKey];
|
|
33
|
+
const propertyValueOne = (_a = itemOne[propertyKey]) !== null && _a !== void 0 ? _a : null;
|
|
34
|
+
const propertyValueTwo = (_b = itemTwo[propertyKey]) !== null && _b !== void 0 ? _b : null;
|
|
35
35
|
if (property.propertyType === types_1.PropertyType.MultiSelect) {
|
|
36
36
|
const propertyValueOneAsArray = getMultiSelectValueAsArray(propertyValueOne);
|
|
37
37
|
const propertyValueTwoAsArray = getMultiSelectValueAsArray(propertyValueTwo);
|
|
38
38
|
return areArraysEqualIgnoreOrder(propertyValueOneAsArray, propertyValueTwoAsArray);
|
|
39
39
|
}
|
|
40
40
|
if (property.propertyType === types_1.PropertyType.SizeRange) {
|
|
41
|
-
const isOfSameSizeRangeTemplate = ((
|
|
41
|
+
const isOfSameSizeRangeTemplate = ((_c = itemOne === null || itemOne === void 0 ? void 0 : itemOne.sizeRangeTemplate) === null || _c === void 0 ? void 0 : _c.id) === ((_d = itemTwo === null || itemTwo === void 0 ? void 0 : itemTwo.sizeRangeTemplate) === null || _d === void 0 ? void 0 : _d.id);
|
|
42
42
|
if (!isOfSameSizeRangeTemplate)
|
|
43
43
|
return false;
|
|
44
44
|
return areSizeRangesEqual(propertyValueOne, propertyValueTwo);
|
|
@@ -67,16 +67,6 @@ class StringUtil {
|
|
|
67
67
|
static isArray(value) {
|
|
68
68
|
return Array.isArray(value);
|
|
69
69
|
}
|
|
70
|
-
static decodeEncodedString(encodedString) {
|
|
71
|
-
return encodedString.replace(/_COMMA_/g, ',').replace(/%[0-9A-Fa-f]{2}/g, (match) => {
|
|
72
|
-
try {
|
|
73
|
-
return decodeURIComponent(match);
|
|
74
|
-
}
|
|
75
|
-
catch (_a) {
|
|
76
|
-
return match;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
70
|
static getStringSizeInMB(str) {
|
|
81
71
|
const bytes = new TextEncoder().encode(str).length;
|
|
82
72
|
return bytes / (1024 * 1024);
|