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.
@@ -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 (a, b) {
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
- if (Array.isArray(a), Array.isArray(b)) return JSON.stringify(a === null || a === void 0 || (_a$sort = a.sort) === null || _a$sort === void 0 ? void 0 : _a$sort.call(a)) === JSON.stringify(b === null || b === void 0 || (_b$sort = b.sort) === null || _b$sort === void 0 ? void 0 : _b$sort.call(b));else if (Array.isArray(a) || Array.isArray(b)) throw new Error("Different types detected!");
321
- return JSON.stringify((_Object$entries$sort = (_Object$entries = Object.entries(omitKeys(a, keys))).sort) === null || _Object$entries$sort === void 0 ? void 0 : _Object$entries$sort.call(_Object$entries)) === JSON.stringify((_Object$entries$sort2 = (_Object$entries2 = Object.entries(omitKeys(b, keys))).sort) === null || _Object$entries$sort2 === void 0 ? void 0 : _Object$entries$sort2.call(_Object$entries2));
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 = _ref2 => {
437
+ const getCorrectTestId = _ref3 => {
417
438
  let {
418
439
  testId = "",
419
440
  withTier = true
420
- } = _ref2;
441
+ } = _ref3;
421
442
  return testId && testId !== undefined ? "".concat(withTier ? "-" : "").concat(testId) : "";
422
443
  };
423
444
  exports.getCorrectTestId = getCorrectTestId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.3.75",
3
+ "version": "1.3.77",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [