UNPKG

figform

Version:
25 lines 1.09 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; 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.io", parent: resolveParent(options, fallback), }; } //# sourceMappingURL=options.js.map