@rkmodules/rules 0.0.121 → 0.0.122

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
@@ -234,12 +234,27 @@ function isTree(value) {
234
234
  Object.keys(value).length > 0 &&
235
235
  Object.values(value).every(function (v) { return Array.isArray(v); }));
236
236
  }
237
+ /**
238
+ * checks whether the tree has no groups at all
239
+ * NOTE: an empty group is not considered an empty tree
240
+ */
237
241
  function isEmptyTree(value) {
238
242
  return (typeof value === "object" &&
239
243
  value !== null &&
240
244
  !Array.isArray(value) &&
241
245
  Object.keys(value).length === 0);
242
246
  }
247
+ /**
248
+ * checks whether the tree has no items. It still may have empty groups
249
+ * use isEmptyTree to check if there are no groups at all
250
+ */
251
+ function isEmpty(value) {
252
+ if (!isTree(value))
253
+ return false;
254
+ if (isEmptyTree(value))
255
+ return true;
256
+ return getBranches(value).every(function (branch) { return branch.length === 0; });
257
+ }
243
258
  function isSingleTon(value) {
244
259
  return (Object.keys(value).length === 1 && Object.values(value)[0].length === 1);
245
260
  }
@@ -7811,5 +7826,5 @@ function DDContext(_a) {
7811
7826
  return React.createElement(DndProvider, { backend: HTML5Backend }, children);
7812
7827
  }
7813
7828
 
7814
- 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, 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 };
7829
+ 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 };
7815
7830
  //# sourceMappingURL=index.esm.js.map