@rkmodules/rules 0.0.121 → 0.0.123

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,25 @@ 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 (isEmptyTree(value))
253
+ return true;
254
+ return getBranches(value).every(function (branch) { return branch.length === 0; });
255
+ }
243
256
  function isSingleTon(value) {
244
257
  return (Object.keys(value).length === 1 && Object.values(value)[0].length === 1);
245
258
  }
@@ -7811,5 +7824,5 @@ function DDContext(_a) {
7811
7824
  return React.createElement(DndProvider, { backend: HTML5Backend }, children);
7812
7825
  }
7813
7826
 
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 };
7827
+ 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
7828
  //# sourceMappingURL=index.esm.js.map