mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Bump to v4.0.0.
This commit is contained in:
24
isElement.js
Normal file
24
isElement.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import isObjectLike from './isObjectLike';
|
||||
import isPlainObject from './isPlainObject';
|
||||
|
||||
/**
|
||||
* Checks if `value` is likely a DOM element.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @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 !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);
|
||||
}
|
||||
|
||||
export default isElement;
|
||||
Reference in New Issue
Block a user