intelicoreact 1.3.75 → 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 +27 -6
- package/package.json +1 -1
package/dist/Functions/utils.js
CHANGED
|
@@ -314,11 +314,32 @@ const downloadFile = async _ref => {
|
|
|
314
314
|
downloadEmulation(response.data, name, response.type);
|
|
315
315
|
};
|
|
316
316
|
exports.downloadFile = downloadFile;
|
|
317
|
-
const compare = function (
|
|
318
|
-
var _a$sort, _b$sort, _Object$entries$sort, _Object$entries, _Object$entries$sort2, _Object$entries2;
|
|
317
|
+
const compare = function (first, second) {
|
|
319
318
|
let keys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
320
|
-
|
|
321
|
-
|
|
319
|
+
//? Если типы НЕ равны - не равны априори
|
|
320
|
+
if (typeof first !== typeof second) return false;
|
|
321
|
+
//? Если ответы на вопрос "массив ли?" не равны, то не равны и типы, значит тоже не равны априори
|
|
322
|
+
if (Array.isArray(first) !== Array.isArray(second)) return false;
|
|
323
|
+
//? Если прошли if-ку - типы условно равны, можем оценивать тип лишь одного параметра, это будет справедливо и для второго
|
|
324
|
+
|
|
325
|
+
//? Если примитивы - просто сравниваем. Кейс с null обработан тут.
|
|
326
|
+
if (!(first instanceof Object)) return first === second;
|
|
327
|
+
|
|
328
|
+
//? Если НЕ приметивы - не важно массив или нет, методы объекта для массива тоже доступны
|
|
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);
|
|
342
|
+
return JSON.stringify(structureForComparingOfFirst) === JSON.stringify(structureForComparingOfSecond);
|
|
322
343
|
};
|
|
323
344
|
|
|
324
345
|
// Set Carret to the End of Input
|
|
@@ -413,11 +434,11 @@ String.prototype.longerThan = function (compareWith) {
|
|
|
413
434
|
String.prototype.lastIndexEqualsTo = function (index) {
|
|
414
435
|
return (this === null || this === void 0 ? void 0 : this.length) - 1 === index;
|
|
415
436
|
};
|
|
416
|
-
const getCorrectTestId =
|
|
437
|
+
const getCorrectTestId = _ref3 => {
|
|
417
438
|
let {
|
|
418
439
|
testId = "",
|
|
419
440
|
withTier = true
|
|
420
|
-
} =
|
|
441
|
+
} = _ref3;
|
|
421
442
|
return testId && testId !== undefined ? "".concat(withTier ? "-" : "").concat(testId) : "";
|
|
422
443
|
};
|
|
423
444
|
exports.getCorrectTestId = getCorrectTestId;
|