UNPKG

xdesign-vue-next

Version:

XDesign Component for vue-next

34 lines (30 loc) 866 B
/** * xdesign v1.0.6 * (c) 2023 xdesign * @license MIT */ import isFunction from 'lodash/isFunction'; import isString from 'lodash/isString'; function getTargetElm(elm) { if (elm) { var _process; var targetElement = null; if (isString(elm)) { targetElement = document.querySelector(elm); } else if (isFunction(elm)) { targetElement = elm(); } else { throw new Error("elm should be string or function"); } if (targetElement) { return targetElement; } if (((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.NODE_ENV) !== "test") { throw new Error("There is no element with given."); } } else { return document.body; } } export { getTargetElm as default }; //# sourceMappingURL=getTargetElm.js.map