UNPKG

figform

Version:
26 lines 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveOptions = resolveOptions; function resolveParent(options, fallback) { if (typeof (options === null || options === void 0 ? void 0 : options.parent) !== "undefined") { return options.parent; } if (typeof (options === null || options === void 0 ? void 0 : options.parentId) !== "undefined") { var parentElement = document.getElementById(options.parentId); if (parentElement === null) { throw new Error("Parent element with id ".concat(options.parentId, " not found")); } return parentElement; } return fallback !== null && fallback !== void 0 ? fallback : document.body; } function resolveOptions(options, fallback) { var _a, _b; if (fallback === void 0) { fallback = null; } return { baseUrl: (_a = options === null || options === void 0 ? void 0 : options.baseUrl) !== null && _a !== void 0 ? _a : "https://figform.com", parent: resolveParent(options, fallback), preview: (_b = options === null || options === void 0 ? void 0 : options.preview) !== null && _b !== void 0 ? _b : false, }; } //# sourceMappingURL=options.js.map