UNPKG

is-dom

Version:

Check if the given object is a dom node

14 lines (10 loc) 310 B
var isObject = require('is-object') var isWindow = require('is-window') function isNode (val) { if (!isObject(val) || !isWindow(window) || typeof window.Node !== 'function') { return false } return typeof val.nodeType === 'number' && typeof val.nodeName === 'string' } module.exports = isNode