UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

44 lines (43 loc) • 1.77 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var validate_exports = {}; __export(validate_exports, { assertQuickActionItems: () => assertQuickActionItems, assertQuickActionListener: () => assertQuickActionListener }); module.exports = __toCommonJS(validate_exports); 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"); } }