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