@rkmodules/rules 0.0.137 → 0.0.138
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
CHANGED
|
@@ -1774,15 +1774,53 @@ var uniqueItems = {
|
|
|
1774
1774
|
inputs: {
|
|
1775
1775
|
items: "any",
|
|
1776
1776
|
},
|
|
1777
|
+
params: {
|
|
1778
|
+
excludeEmpty: {
|
|
1779
|
+
type: "boolean",
|
|
1780
|
+
default: false,
|
|
1781
|
+
label: "remove empty",
|
|
1782
|
+
},
|
|
1783
|
+
},
|
|
1777
1784
|
outputs: {
|
|
1778
1785
|
unique: "any",
|
|
1779
1786
|
},
|
|
1780
|
-
impl: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
1787
|
+
impl: function (_a, params_1) { return __awaiter(void 0, [_a, params_1], void 0, function (_b, params) {
|
|
1788
|
+
var noEmpty;
|
|
1781
1789
|
var _c = _b.items, items = _c === void 0 ? {} : _c;
|
|
1782
1790
|
return __generator(this, function (_d) {
|
|
1791
|
+
noEmpty = params.excludeEmpty;
|
|
1783
1792
|
return [2 /*return*/, {
|
|
1784
1793
|
unique: mapTreeBranch(items, function (items) {
|
|
1785
|
-
|
|
1794
|
+
var unique = new Set(items);
|
|
1795
|
+
if (noEmpty) {
|
|
1796
|
+
unique.delete(undefined);
|
|
1797
|
+
unique.delete(null);
|
|
1798
|
+
}
|
|
1799
|
+
return Array.from(unique);
|
|
1800
|
+
}),
|
|
1801
|
+
}];
|
|
1802
|
+
});
|
|
1803
|
+
}); },
|
|
1804
|
+
};
|
|
1805
|
+
|
|
1806
|
+
var coalesce = {
|
|
1807
|
+
name: "coalesce",
|
|
1808
|
+
label: "Coalesce Items",
|
|
1809
|
+
description: "Outputs the first item if it's not empty, otherwise the second item",
|
|
1810
|
+
inputs: {
|
|
1811
|
+
treeA: { type: "any" },
|
|
1812
|
+
treeB: { type: "any" },
|
|
1813
|
+
},
|
|
1814
|
+
outputs: {
|
|
1815
|
+
tree: "any",
|
|
1816
|
+
},
|
|
1817
|
+
impl: function (_a, params_1) { return __awaiter(void 0, [_a, params_1], void 0, function (_b, params) {
|
|
1818
|
+
var _c = _b.treeA, treeA = _c === void 0 ? {} : _c, _d = _b.treeB, treeB = _d === void 0 ? {} : _d;
|
|
1819
|
+
return __generator(this, function (_e) {
|
|
1820
|
+
return [2 /*return*/, {
|
|
1821
|
+
tree: nAryOnTree([treeA, treeB], function (_a) {
|
|
1822
|
+
var _b = __read(_a, 2), itemA = _b[0], itemB = _b[1];
|
|
1823
|
+
return itemA !== undefined && itemA !== null ? itemA : itemB;
|
|
1786
1824
|
}),
|
|
1787
1825
|
}];
|
|
1788
1826
|
});
|
|
@@ -1798,6 +1836,7 @@ var primitives$6 = (_a$6 = {},
|
|
|
1798
1836
|
_a$6[relativeItem.name] = relativeItem,
|
|
1799
1837
|
_a$6[relativeItems.name] = relativeItems,
|
|
1800
1838
|
_a$6[concat.name] = concat,
|
|
1839
|
+
_a$6[coalesce.name] = coalesce,
|
|
1801
1840
|
_a$6[uniqueItems.name] = uniqueItems,
|
|
1802
1841
|
_a$6);
|
|
1803
1842
|
|