one
Version:
One is a React framework for web, iOS, and Android apps.
21 lines (19 loc) • 871 B
JavaScript
function assertQuickActionItems(value) {
if (!Array.isArray(value)) {
throw new TypeError("QuickActions.setItems: items must be an array");
}
const seen = /* @__PURE__ */ new Set();
for (const item of value) {
if (!item || typeof item !== "object" || typeof item.id !== "string" || !item.id.trim() || typeof item.title !== "string" || !item.title.trim() || item.subtitle !== void 0 && typeof item.subtitle !== "string" || seen.has(item.id)) {
throw new TypeError("QuickActions.setItems: items require unique non-empty id and title with optional string subtitle");
}
seen.add(item.id);
}
}
function assertQuickActionListener(value) {
if (typeof value !== "function") {
throw new TypeError("QuickActions.addListener: listener must be a function");
}
}
export { assertQuickActionItems, assertQuickActionListener };
//# sourceMappingURL=validate.mjs.map