@rkmodules/rules 0.0.130 → 0.0.131

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/index.esm.js CHANGED
@@ -371,10 +371,13 @@ function forEachItem(tree, fn) {
371
371
  });
372
372
  });
373
373
  }
374
- function pushItem(tree, path, item) {
374
+ function ensureBranch(tree, path) {
375
375
  if (!tree[path]) {
376
376
  tree[path] = [];
377
377
  }
378
+ }
379
+ function pushItem(tree, path, item) {
380
+ ensureBranch(tree, path);
378
381
  tree[path].push(item);
379
382
  }
380
383
  /**
@@ -2474,6 +2477,8 @@ var explodeObject = {
2474
2477
  branch.forEach(function (obj, index) {
2475
2478
  if (!obj)
2476
2479
  return;
2480
+ if (typeof obj !== "object")
2481
+ obj = null;
2477
2482
  if (obj === null && params.removeEmpty)
2478
2483
  ;
2479
2484
  var props = obj || {};
@@ -2490,6 +2495,15 @@ var explodeObject = {
2490
2495
  });
2491
2496
  });
2492
2497
  });
2498
+ if (!params.removeEmpty) {
2499
+ // ensure the same branches exist in the output even if they are empty, so that the outputs don't change shape when empty branches are added or removed from the input
2500
+ Object.entries(outputs).forEach(function (_a) {
2501
+ var _b = __read(_a, 2); _b[0]; var tree = _b[1];
2502
+ forEachBranch(object, function (branch, path) {
2503
+ ensureBranch(tree, path);
2504
+ });
2505
+ });
2506
+ }
2493
2507
  return [2 /*return*/, outputs];
2494
2508
  });
2495
2509
  }); },
@@ -8159,5 +8173,5 @@ function DDContext(_a) {
8159
8173
  return React.createElement(DndProvider, { backend: HTML5Backend }, children);
8160
8174
  }
8161
8175
 
8162
- export { DDContext, DISCARD, Engine, Flow, GenericNode, Lib, binaryOnTree, binaryOnTreeBranch, broadCast, expandTree, forEachBranch, forEachItem, getBranch, getBranches, getItem, getPaths, getPositions, getReferences, getValue$1 as getValue, getVariable, graftTree, hasReference, interpolate, isEmpty, isEmptyTree, isReference, isSingleTon, isTree, mapTree, mapTreeBranch, nAryOnTree, nAryOnTreeBranch, normalizePaths, normalizeVarDef, parseReference, primitives, pushItem, sameShape, simplifyTree$1 as simplifyTree, toArray, topSort, treeSize, treeStats, trimTree, uid$1 as uid, useDraggableNode, useFlow, useFunction, usePositions, useUpdatePositions, useVariable, variableStore };
8176
+ export { DDContext, DISCARD, Engine, Flow, GenericNode, Lib, binaryOnTree, binaryOnTreeBranch, broadCast, ensureBranch, expandTree, forEachBranch, forEachItem, getBranch, getBranches, getItem, getPaths, getPositions, getReferences, getValue$1 as getValue, getVariable, graftTree, hasReference, interpolate, isEmpty, isEmptyTree, isReference, isSingleTon, isTree, mapTree, mapTreeBranch, nAryOnTree, nAryOnTreeBranch, normalizePaths, normalizeVarDef, parseReference, primitives, pushItem, sameShape, simplifyTree$1 as simplifyTree, toArray, topSort, treeSize, treeStats, trimTree, uid$1 as uid, useDraggableNode, useFlow, useFunction, usePositions, useUpdatePositions, useVariable, variableStore };
8163
8177
  //# sourceMappingURL=index.esm.js.map