@rkmodules/rules 0.0.97 → 0.0.98

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 CHANGED
@@ -263,6 +263,20 @@ function getBranches(tree) {
263
263
  function getPaths(tree) {
264
264
  return Object.keys(tree);
265
265
  }
266
+ function forEachBranch(tree, fn) {
267
+ var paths = getPaths(tree);
268
+ paths.forEach(function (path, i) {
269
+ var branch = tree[path];
270
+ fn(branch, path, i);
271
+ });
272
+ }
273
+ function forEachItem(tree, fn) {
274
+ forEachBranch(tree, function (branch, path, pathIndex) {
275
+ branch.forEach(function (item, i) {
276
+ fn(item, path, pathIndex, i);
277
+ });
278
+ });
279
+ }
266
280
  /**
267
281
  * 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
268
282
  * @param tree
@@ -7255,6 +7269,8 @@ exports.binaryOnTree = binaryOnTree;
7255
7269
  exports.binaryOnTreeBranch = binaryOnTreeBranch;
7256
7270
  exports.broadCast = broadCast;
7257
7271
  exports.expandTree = expandTree;
7272
+ exports.forEachBranch = forEachBranch;
7273
+ exports.forEachItem = forEachItem;
7258
7274
  exports.getBranch = getBranch;
7259
7275
  exports.getBranches = getBranches;
7260
7276
  exports.getPaths = getPaths;