@rkmodules/rules 0.0.120 → 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.cjs.js +16 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +16 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/DataTree/index.d.ts +9 -0
- package/dist/lib/Engine/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -236,12 +236,27 @@ 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 (!isTree(value))
|
|
255
|
+
return false;
|
|
256
|
+
if (isEmptyTree(value))
|
|
257
|
+
return true;
|
|
258
|
+
return getBranches(value).every(function (branch) { return branch.length === 0; });
|
|
259
|
+
}
|
|
245
260
|
function isSingleTon(value) {
|
|
246
261
|
return (Object.keys(value).length === 1 && Object.values(value)[0].length === 1);
|
|
247
262
|
}
|
|
@@ -7836,6 +7851,7 @@ exports.getVariable = getVariable;
|
|
|
7836
7851
|
exports.graftTree = graftTree;
|
|
7837
7852
|
exports.hasReference = hasReference;
|
|
7838
7853
|
exports.interpolate = interpolate;
|
|
7854
|
+
exports.isEmpty = isEmpty;
|
|
7839
7855
|
exports.isEmptyTree = isEmptyTree;
|
|
7840
7856
|
exports.isReference = isReference;
|
|
7841
7857
|
exports.isSingleTon = isSingleTon;
|