UNPKG

vanillajs-browser-helpers

Version:

Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS in the browser

10 lines (9 loc) 250 B
/** * Is the given object a DOM Node * * @param obj - The object to check * @return Is it a DOM node or not */ export default function isDOMNode(node: unknown): node is Node { return !!node && typeof (node as Node).nodeType !== 'undefined'; }