1 | import isObjectLike from './isObjectLike.js';
|
2 | import isPlainObject from './isPlainObject.js';
|
3 |
|
4 | /**
|
5 | * Checks if `value` is likely a DOM element.
|
6 | *
|
7 | * @static
|
8 | * @memberOf _
|
9 | * @since 0.1.0
|
10 | * @category Lang
|
11 | * @param {*} value The value to check.
|
12 | * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
|
13 | * @example
|
14 | *
|
15 | * _.isElement(document.body);
|
16 | * // => true
|
17 | *
|
18 | * _.isElement('<body>');
|
19 | * // => false
|
20 | */
|
21 | function isElement(value) {
|
22 | return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
|
23 | }
|
24 |
|
25 | export default isElement;
|