The `is-dom` package provides a minimalist utility function to determine if a given JavaScript object is a DOM node. It offers a single export, `isDom`, which returns `true` for valid DOM nodes (like `document`, `HTMLElement` instances, `Text` nodes, etc.) and `false` otherwise. This library is currently at version 1.1.0 and, given its focused scope, typically experiences a very slow release cadence, with updates primarily for bug fixes or compatibility adjustments rather than new features. Its key differentiator is its extreme simplicity and singular purpose, avoiding larger DOM manipulation libraries when only a type check is required. It's often used in environments where direct DOM access is available, such as browsers or Node.js with a JSDOM environment, to ensure operations are performed on actual DOM elements.
npm install is-domVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the 'is-dom' function to accurately check if various JavaScript values are recognized as DOM nodes, showcasing its utility in both browser and potentially JSDOM environments.
Ensure you are using the correct default import syntax: `import isDom from 'is-dom';` in ESM environments.
Run your code in a browser environment or integrate a DOM emulation library like JSDOM for Node.js testing: `const { JSDOM } = require('jsdom'); global.document = new JSDOM().window.document;`Ensure your code is running in a browser environment or use a library like JSDOM in Node.js to simulate the DOM for testing purposes. Example: `const { JSDOM } = require('jsdom'); global.document = new JSDOM().window.document;`If importing in an ESM context, use `import isDom from 'is-dom';` instead of `import { isDom } from 'is-dom';`.No dependency data recorded yet.