Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
574 bytes
|
Line | |
---|
1 | var isObjectLike = require('./isObjectLike'),
|
---|
2 | isPlainObject = require('./isPlainObject');
|
---|
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 | module.exports = isElement;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.