UNPKG

iselement

Version:

Utility function that returns `true` if referenced object is DOM element.

11 lines (10 loc) 605 B
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; /** * Returns `true` if provided input is Element. * @name isElement * @param {*} [input] * @returns {boolean} */ export default function (input) { return input != null && (typeof input === 'undefined' ? 'undefined' : _typeof(input)) === 'object' && input.nodeType === 1 && _typeof(input.style) === 'object' && _typeof(input.ownerDocument) === 'object'; }