Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

is-element.js 769B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. var div = typeof document !== "undefined" && document.createElement("div");
  3. /**
  4. * Returns `true` when `object` is a DOM element node.
  5. *
  6. * Unlike Underscore.js/lodash, this function will return `false` if `object`
  7. * is an *element-like* object, i.e. a regular object with a `nodeType`
  8. * property that holds the value `1`.
  9. *
  10. * @alias module:samsam.isElement
  11. * @param {object} object The object to examine
  12. * @returns {boolean} Returns `true` for DOM element nodes
  13. */
  14. function isElement(object) {
  15. if (!object || object.nodeType !== 1 || !div) {
  16. return false;
  17. }
  18. try {
  19. object.appendChild(div);
  20. object.removeChild(div);
  21. } catch (e) {
  22. return false;
  23. }
  24. return true;
  25. }
  26. module.exports = isElement;