UNPKG

@react-bootstrap/react-popper

Version:
28 lines (23 loc) 759 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Takes an argument and if it's an array, returns the first item in the array, * otherwise returns the argument. Used for Preact compatibility. */ var unwrapArray = exports.unwrapArray = function unwrapArray(arg) { return Array.isArray(arg) ? arg[0] : arg; }; /** * Takes a maybe-undefined function and arbitrary args and invokes the function * only if it is defined. */ var safeInvoke = exports.safeInvoke = function safeInvoke(fn) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } if (typeof fn === "function") { return fn.apply(undefined, args); } };