You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
574 B

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