@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.cjs.js +14 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +14 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/DataTree/index.d.ts +9 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -236,12 +236,25 @@ function isTree(value) {
|
|
|
236
236
|
Object.keys(value).length > 0 &&
|
|
237
237
|
Object.values(value).every(function (v) { return Array.isArray(v); }));
|
|
238
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* checks whether the tree has no groups at all
|
|
241
|
+
* NOTE: an empty group is not considered an empty tree
|
|
242
|
+
*/
|
|
239
243
|
function isEmptyTree(value) {
|
|
240
244
|
return (typeof value === "object" &&
|
|
241
245
|
value !== null &&
|
|
242
246
|
!Array.isArray(value) &&
|
|
243
247
|
Object.keys(value).length === 0);
|
|
244
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* checks whether the tree has no items. It still may have empty groups
|
|
251
|
+
* use isEmptyTree to check if there are no groups at all
|
|
252
|
+
*/
|
|
253
|
+
function isEmpty(value) {
|
|
254
|
+
if (isEmptyTree(value))
|
|
255
|
+
return true;
|
|
256
|
+
return getBranches(value).every(function (branch) { return branch.length === 0; });
|
|
257
|
+
}
|
|
245
258
|
function isSingleTon(value) {
|
|
246
259
|
return (Object.keys(value).length === 1 && Object.values(value)[0].length === 1);
|
|
247
260
|
}
|
|
@@ -7836,6 +7849,7 @@ exports.getVariable = getVariable;
|
|
|
7836
7849
|
exports.graftTree = graftTree;
|
|
7837
7850
|
exports.hasReference = hasReference;
|
|
7838
7851
|
exports.interpolate = interpolate;
|
|
7852
|
+
exports.isEmpty = isEmpty;
|
|
7839
7853
|
exports.isEmptyTree = isEmptyTree;
|
|
7840
7854
|
exports.isReference = isReference;
|
|
7841
7855
|
exports.isSingleTon = isSingleTon;
|