@startinblox/core 1.0.0-beta.1 → 1.0.0-beta.3
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.
|
@@ -1497,30 +1497,31 @@ const compare = {
|
|
|
1497
1497
|
}
|
|
1498
1498
|
};
|
|
1499
1499
|
function generalComparator(a, b, order = "asc") {
|
|
1500
|
-
|
|
1500
|
+
if (order === "desc") return generalComparator(b, a);
|
|
1501
|
+
if (a == null && b == null) return 0;
|
|
1502
|
+
if (a === b || Object.is(a, b)) return 0;
|
|
1501
1503
|
if (typeof a === "boolean" && typeof b === "boolean") {
|
|
1502
|
-
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1504
|
+
return a === b ? 0 : a ? 1 : -1;
|
|
1505
|
+
}
|
|
1506
|
+
if (!Number.isNaN(Number(a)) && !Number.isNaN(Number(b))) {
|
|
1507
|
+
return Number(a) - Number(b);
|
|
1508
|
+
}
|
|
1509
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
1510
|
+
return a.length - b.length;
|
|
1511
|
+
}
|
|
1512
|
+
const dateA = Date.parse(String(a));
|
|
1513
|
+
const dateB = Date.parse(String(b));
|
|
1514
|
+
if (!Number.isNaN(dateA) && !Number.isNaN(dateB)) {
|
|
1515
|
+
return dateA - dateB;
|
|
1516
|
+
}
|
|
1517
|
+
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
1512
1518
|
const aKeys = Object.keys(a);
|
|
1513
1519
|
const bKeys = Object.keys(b);
|
|
1514
|
-
|
|
1515
|
-
} else if (a == null || b == null) {
|
|
1516
|
-
comparison = a == null ? b == null ? 0 : -1 : b == null ? 1 : 0;
|
|
1517
|
-
} else {
|
|
1518
|
-
comparison = a.toString().localeCompare(b.toString());
|
|
1519
|
-
}
|
|
1520
|
-
if (order === "desc") {
|
|
1521
|
-
comparison = comparison * -1;
|
|
1520
|
+
return aKeys.length - bKeys.length;
|
|
1522
1521
|
}
|
|
1523
|
-
return
|
|
1522
|
+
if (a == null) return -1;
|
|
1523
|
+
if (b == null) return 1;
|
|
1524
|
+
return String(a).localeCompare(String(b));
|
|
1524
1525
|
}
|
|
1525
1526
|
function transformArrayToContainer(resource) {
|
|
1526
1527
|
const newValue = { ...resource };
|
package/dist/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, a, o, c, A as A2, d, n, e, f, b, g, k, i, l, m, p, s, j, t, u } from "./helpers-
|
|
1
|
+
import { A, a, o, c, A as A2, d, n, e, f, b, g, k, i, l, m, p, s, j, t, u } from "./helpers-C8RJ0BtV.js";
|
|
2
2
|
export {
|
|
3
3
|
A as AsyncIterableBuilder,
|
|
4
4
|
a as asyncQuerySelector,
|