A simple and fast way to get started is to include this script on your page:
<script src="https://unpkg.com/is-dom-node"></script>
This will create the global variable isDomNode
.
npm install is-dom-node
const isDomNode = require('is-dom-node')
import isDomNode from 'is-dom-node'
const node = document.querySelector('#cake')
isDomNode(node)
// => true
const html = '<div id="cake"></div>'
isDomNode(html)
// => false