intelicoreact 1.3.76 → 1.3.77
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/dist/Functions/utils.js +15 -9
- package/package.json +1 -1
package/dist/Functions/utils.js
CHANGED
|
@@ -315,7 +315,6 @@ const downloadFile = async _ref => {
|
|
|
315
315
|
};
|
|
316
316
|
exports.downloadFile = downloadFile;
|
|
317
317
|
const compare = function (first, second) {
|
|
318
|
-
var _Object$entries$sort, _Object$entries, _Object$entries$sort2, _Object$entries2;
|
|
319
318
|
let keys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
320
319
|
//? Если типы НЕ равны - не равны априори
|
|
321
320
|
if (typeof first !== typeof second) return false;
|
|
@@ -326,13 +325,20 @@ const compare = function (first, second) {
|
|
|
326
325
|
//? Если примитивы - просто сравниваем. Кейс с null обработан тут.
|
|
327
326
|
if (!(first instanceof Object)) return first === second;
|
|
328
327
|
|
|
329
|
-
//? Исключение для ф-й.
|
|
330
|
-
if (typeof first === 'function') return first.name === second.name;
|
|
331
|
-
|
|
332
328
|
//? Если НЕ приметивы - не важно массив или нет, методы объекта для массива тоже доступны
|
|
333
|
-
|
|
334
|
-
const
|
|
335
|
-
|
|
329
|
+
|
|
330
|
+
const getComparationStructure = data => {
|
|
331
|
+
if (typeof data === 'function') return data.toString();
|
|
332
|
+
if (!(data instanceof Object)) return data;
|
|
333
|
+
return Object.entries(data).sort((a, b) => a[0].localeCompare(b[0])).map(_ref2 => {
|
|
334
|
+
let [key, value] = _ref2;
|
|
335
|
+
return [key, getComparationStructure(data[key])];
|
|
336
|
+
});
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
//? Получаем структуры для сравнения (с учетом глубины) - массивы массивов, сортируем по ключам,
|
|
340
|
+
const structureForComparingOfFirst = getComparationStructure(first);
|
|
341
|
+
const structureForComparingOfSecond = getComparationStructure(second);
|
|
336
342
|
return JSON.stringify(structureForComparingOfFirst) === JSON.stringify(structureForComparingOfSecond);
|
|
337
343
|
};
|
|
338
344
|
|
|
@@ -428,11 +434,11 @@ String.prototype.longerThan = function (compareWith) {
|
|
|
428
434
|
String.prototype.lastIndexEqualsTo = function (index) {
|
|
429
435
|
return (this === null || this === void 0 ? void 0 : this.length) - 1 === index;
|
|
430
436
|
};
|
|
431
|
-
const getCorrectTestId =
|
|
437
|
+
const getCorrectTestId = _ref3 => {
|
|
432
438
|
let {
|
|
433
439
|
testId = "",
|
|
434
440
|
withTier = true
|
|
435
|
-
} =
|
|
441
|
+
} = _ref3;
|
|
436
442
|
return testId && testId !== undefined ? "".concat(withTier ? "-" : "").concat(testId) : "";
|
|
437
443
|
};
|
|
438
444
|
exports.getCorrectTestId = getCorrectTestId;
|