@dxos/util 0.7.5-main.9d26e3a → 0.7.5-main.9d2a38b

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.
@@ -33,6 +33,24 @@ var distinctBy = (array, selector) => {
33
33
  return true;
34
34
  });
35
35
  };
36
+ var partition = (array, guard) => {
37
+ return array.reduce(([accepted, rejected], item, index, array2) => guard(item, index, array2) ? [
38
+ [
39
+ ...accepted,
40
+ item
41
+ ],
42
+ rejected
43
+ ] : [
44
+ accepted,
45
+ [
46
+ ...rejected,
47
+ item
48
+ ]
49
+ ], [
50
+ [],
51
+ []
52
+ ]);
53
+ };
36
54
 
37
55
  // packages/common/util/src/binder.ts
38
56
  import util from "@dxos/node-std/util";
@@ -542,6 +560,20 @@ var getDeep = (obj, path) => {
542
560
  return parent;
543
561
  };
544
562
 
563
+ // packages/common/util/src/disposition.ts
564
+ var byDisposition = (a, b) => {
565
+ const aDisposition = a.disposition ?? "static";
566
+ const bDisposition = b.disposition ?? "static";
567
+ if (aDisposition === bDisposition) {
568
+ return 0;
569
+ } else if (aDisposition === "hoist" || bDisposition === "fallback") {
570
+ return -1;
571
+ } else if (bDisposition === "hoist" || aDisposition === "fallback") {
572
+ return 1;
573
+ }
574
+ return 0;
575
+ };
576
+
545
577
  // packages/common/util/src/entry.ts
546
578
  var entry = (map, key) => new MapEntry(map, key);
547
579
  var MapEntry = class {
@@ -1994,6 +2026,7 @@ export {
1994
2026
  arraysEqual,
1995
2027
  boolGuard,
1996
2028
  bufferToArray,
2029
+ byDisposition,
1997
2030
  chunkArray,
1998
2031
  compareMulti,
1999
2032
  compareObject,
@@ -2054,6 +2087,7 @@ export {
2054
2087
  numericalValues,
2055
2088
  omit,
2056
2089
  orderKeys,
2090
+ partition,
2057
2091
  pick,
2058
2092
  pickBy,
2059
2093
  randomInt,