unist-util-find is a focused utility within the Unist ecosystem (supporting mdast, hast, nlcst, etc.) designed to efficiently locate the first node in a Unist tree that satisfies a given condition. The current stable version is 3.0.0. Maintained by the unified collective, it typically follows Node.js LTS release cycles for major version updates. Its key differentiator lies in its simplicity for finding a single matching node, offering a lightweight alternative to more comprehensive tree-walking utilities like `unist-util-visit` when only the first match is needed. Conditions can be specified as a string, an object, or a predicate function, providing flexible search capabilities.
npm install unist-util-findVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `unist-util-find` with string, object, and function conditions to locate nodes within an mdast tree.
Ensure your Node.js environment is version 16 or newer. Update your Node.js runtime if necessary.
Migrate your project to use ES Modules (ESM) by adding `"type": "module"` to your `package.json` and using `import` statements. If you must use CommonJS, you'll need to use an older version (<2.0.0) or dynamically import it.
Only use the public `find` named export as documented. Avoid importing from deep paths within the package.
Always use named import syntax: `import { find } from 'unist-util-find'`.Ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`) and use `import { find } from 'unist-util-find'`.Verify that `import { find } from 'unist-util-find'` is used for the named export, and not `import find from 'unist-util-find'`.No dependency data recorded yet.