@rkmodules/rules 0.0.64 → 0.0.66

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
@@ -271,7 +271,7 @@ function mapTreeBranch(tree, fn) {
271
271
  return nAryOnTreeBranch([tree], function mapTreeBranchCallback(_a, _b) {
272
272
  var _c = __read(_a, 1), branch = _c[0];
273
273
  var _d = __read(_b, 1), path = _d[0];
274
- return fn(branch, path);
274
+ return fn(branch || [], path);
275
275
  });
276
276
  }
277
277
  /**
@@ -291,12 +291,12 @@ function nAryOnTreeBranch(trees, fn) {
291
291
  var maxBranches = Math.max.apply(Math, __spreadArray([], __read(allKeys.map(function (keys) { return keys.length; })), false));
292
292
  var _loop_2 = function (i) {
293
293
  var paths = allKeys.map(function (keys) { return keys[Math.min(i, keys.length - 1)]; });
294
- var branches = trees.map(function (tree) { return tree[paths[trees.indexOf(tree)]] || []; });
294
+ var branches = trees.map(function (tree) { return tree[paths[trees.indexOf(tree)]]; });
295
295
  // get all the paths of which the trees are the longest, use the first
296
296
  var maxPaths = paths.filter(function (_, i) { return allKeys[i].length === maxBranches; });
297
297
  var path = maxPaths[0];
298
298
  var newBranch = fn(branches, paths);
299
- if (newBranch === null || newBranch === void 0 ? void 0 : newBranch.length) {
299
+ if (newBranch !== DISCARD) {
300
300
  result[path] = newBranch;
301
301
  }
302
302
  };
@@ -322,12 +322,14 @@ function nAryOnTreeBranch(trees, fn) {
322
322
  */
323
323
  function nAryOnTree(trees, fn, fill) {
324
324
  return nAryOnTreeBranch(trees, function nAryOnTreeCallback(branches, paths) {
325
- var maxLength = Math.max.apply(Math, __spreadArray([], __read(branches.map(function (b) { return b.length; })), false));
326
- if (maxLength === 0)
327
- return; // Skip empty branches
325
+ var maxLength = Math.max.apply(Math, __spreadArray([], __read(branches.map(function (b) {
326
+ if (b === void 0) { b = []; }
327
+ return b.length;
328
+ })), false));
328
329
  var results = [];
329
330
  var _loop_3 = function (i) {
330
331
  var items = branches.map(function (b) {
332
+ if (b === void 0) { b = []; }
331
333
  if (fill) {
332
334
  // repeat last item if index exceeds branch length
333
335
  return b[Math.min(i, b.length - 1)];
@@ -361,7 +363,7 @@ function binaryOnTreeBranch(treeA, treeB, fn) {
361
363
  return nAryOnTreeBranch([treeA, treeB], function binaryOnTreeBranchCallback(_a, _b) {
362
364
  var _c = __read(_a, 2), branchA = _c[0], branchB = _c[1];
363
365
  var _d = __read(_b, 2), pathA = _d[0], pathB = _d[1];
364
- return fn(branchA, branchB, pathA, pathB);
366
+ return fn(branchA || [], branchB || [], pathA, pathB);
365
367
  });
366
368
  }
367
369
  /**