Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
23 lines (21 sloc)
536 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import isObjectLike from './isObjectLike.js' | |
import isPlainObject from './isPlainObject.js' | |
/** | |
* Checks if `value` is likely a DOM element. | |
* | |
* @since 0.1.0 | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. | |
* @example | |
* | |
* isElement(document.body) | |
* // => true | |
* | |
* isElement('<body>') | |
* // => false | |
*/ | |
function isElement(value) { | |
return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value) | |
} | |
export default isElement |