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