Determine if an object is a
Document
(from anyRealm
).
Node.js >= 10
is required. To install, type this at the command line:
npm install is-dom-document
ES Module:
import isDOMDocument from 'is-dom-document';
CommonJS Module:
const isDOMDocument = require('is-dom-document');
isDOMDocument(window.document); //-> true
isDOMDocument({}); //-> false