cx 22.6.2 → 22.6.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.
package/dist/data.js CHANGED
@@ -2209,6 +2209,28 @@ function insertElement(array, index) {
2209
2209
  return [].concat(array.slice(0, index), args, array.slice(index));
2210
2210
  }
2211
2211
 
2212
+ function findTreePath(array, criteria, childrenField, currentPath) {
2213
+ if (childrenField === void 0) {
2214
+ childrenField = "$children";
2215
+ }
2216
+
2217
+ if (currentPath === void 0) {
2218
+ currentPath = [];
2219
+ }
2220
+
2221
+ if (!Array.isArray(array)) return false;
2222
+
2223
+ for (var i = 0; i < array.length; i++) {
2224
+ currentPath.push(array[i]);
2225
+ if (criteria(array[i])) return currentPath;
2226
+ var childPath = findTreePath(array[i][childrenField], criteria, childrenField, currentPath);
2227
+ if (childPath) return childPath;
2228
+ currentPath.pop();
2229
+ }
2230
+
2231
+ return false;
2232
+ }
2233
+
2212
2234
  function diffArrays(oldArray, newArray, keyFn) {
2213
2235
  if (!keyFn)
2214
2236
  keyFn = function keyFn(e) {
@@ -2466,6 +2488,7 @@ export {
2466
2488
  expression,
2467
2489
  filter,
2468
2490
  findTreeNode,
2491
+ findTreePath,
2469
2492
  getAccessor,
2470
2493
  getComparer,
2471
2494
  getSelector,