@rkmodules/rules 0.0.98 → 0.0.99
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 +14 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +13 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/DataTree/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -263,6 +263,12 @@ function getBranches(tree) {
|
|
|
263
263
|
function getPaths(tree) {
|
|
264
264
|
return Object.keys(tree);
|
|
265
265
|
}
|
|
266
|
+
function getItem(tree, path, index) {
|
|
267
|
+
var branch = getBranch(tree, path);
|
|
268
|
+
if (branch) {
|
|
269
|
+
return branch[index];
|
|
270
|
+
}
|
|
271
|
+
}
|
|
266
272
|
function forEachBranch(tree, fn) {
|
|
267
273
|
var paths = getPaths(tree);
|
|
268
274
|
paths.forEach(function (path, i) {
|
|
@@ -277,6 +283,12 @@ function forEachItem(tree, fn) {
|
|
|
277
283
|
});
|
|
278
284
|
});
|
|
279
285
|
}
|
|
286
|
+
function pushItem(tree, path, item) {
|
|
287
|
+
if (!tree[path]) {
|
|
288
|
+
tree[path] = [];
|
|
289
|
+
}
|
|
290
|
+
tree[path].push(item);
|
|
291
|
+
}
|
|
280
292
|
/**
|
|
281
293
|
* maps a tree, the tree branches are flatmapped, so if an array is returned for each item in the list, a flat list is returned
|
|
282
294
|
* @param tree
|
|
@@ -7273,6 +7285,7 @@ exports.forEachBranch = forEachBranch;
|
|
|
7273
7285
|
exports.forEachItem = forEachItem;
|
|
7274
7286
|
exports.getBranch = getBranch;
|
|
7275
7287
|
exports.getBranches = getBranches;
|
|
7288
|
+
exports.getItem = getItem;
|
|
7276
7289
|
exports.getPaths = getPaths;
|
|
7277
7290
|
exports.getPositions = getPositions;
|
|
7278
7291
|
exports.getReferences = getReferences;
|
|
@@ -7291,6 +7304,7 @@ exports.nAryOnTreeBranch = nAryOnTreeBranch;
|
|
|
7291
7304
|
exports.normalizeVarDef = normalizeVarDef;
|
|
7292
7305
|
exports.parseReference = parseReference;
|
|
7293
7306
|
exports.primitives = primitives;
|
|
7307
|
+
exports.pushItem = pushItem;
|
|
7294
7308
|
exports.sameShape = sameShape;
|
|
7295
7309
|
exports.simplifyTree = simplifyTree$1;
|
|
7296
7310
|
exports.toArray = toArray;
|