@rkmodules/rules 0.0.129 → 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.cjs.js +19 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +19 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/DataTree/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -371,10 +371,13 @@ function forEachItem(tree, fn) {
|
|
|
371
371
|
});
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
|
-
function
|
|
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
|
/**
|
|
@@ -2457,6 +2460,7 @@ var explodeObject = {
|
|
|
2457
2460
|
},
|
|
2458
2461
|
params: {
|
|
2459
2462
|
split: { type: "boolean", default: false, label: "split groups" },
|
|
2463
|
+
removeEmpty: { type: "boolean", default: false, label: "remove empty" },
|
|
2460
2464
|
},
|
|
2461
2465
|
outputs: {
|
|
2462
2466
|
// values: "any",
|
|
@@ -2473,6 +2477,10 @@ var explodeObject = {
|
|
|
2473
2477
|
branch.forEach(function (obj, index) {
|
|
2474
2478
|
if (!obj)
|
|
2475
2479
|
return;
|
|
2480
|
+
if (typeof obj !== "object")
|
|
2481
|
+
obj = null;
|
|
2482
|
+
if (obj === null && params.removeEmpty)
|
|
2483
|
+
;
|
|
2476
2484
|
var props = obj || {};
|
|
2477
2485
|
Object.entries(props).forEach(function (_a) {
|
|
2478
2486
|
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
@@ -2487,6 +2495,15 @@ var explodeObject = {
|
|
|
2487
2495
|
});
|
|
2488
2496
|
});
|
|
2489
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
|
+
}
|
|
2490
2507
|
return [2 /*return*/, outputs];
|
|
2491
2508
|
});
|
|
2492
2509
|
}); },
|
|
@@ -8156,5 +8173,5 @@ function DDContext(_a) {
|
|
|
8156
8173
|
return React.createElement(DndProvider, { backend: HTML5Backend }, children);
|
|
8157
8174
|
}
|
|
8158
8175
|
|
|
8159
|
-
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 };
|
|
8160
8177
|
//# sourceMappingURL=index.esm.js.map
|