unist-util-remove is a utility package within the unified ecosystem designed to modify unist (Universal Syntax Tree) structures by removing nodes that pass a given test. Unlike `unist-util-filter`, this utility mutates the tree in-place, which can offer significant performance benefits on large documents. The current stable version is 4.0.0, which notably introduced a requirement for Node.js 16+, transitioned to being an ESM-only package, and altered the return type of the `remove` function from the modified tree to `undefined`. The package maintains compatibility with actively maintained Node.js versions and receives updates for bug fixes, performance improvements, and minor enhancements. Major version releases typically align with Node.js LTS updates or significant architectural shifts within the unified ecosystem, such as the move to ESM.
npm install unist-util-removeVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing `remove` and using it to mutate a unist tree by removing nodes matching a type, including an example of the `cascade` option.
Upgrade your Node.js environment to version 16 or higher, or pin to an older major version of unist-util-remove (e.g., `unist-util-remove@^3`).
Migrate your project to ESM by setting `"type": "module"` in your `package.json` or by using dynamic `import()` for this package. Use `import { remove } from 'unist-util-remove'`.Remove any code that expects `remove` to return the tree. The `tree` object passed to `remove` is modified directly. If you need to test if the root `tree` itself should be removed, do so explicitly with `unist-util-is` before calling `remove` on its children.
If you were explicitly using `RemoveOptions`, update your type annotations. The `Options` type is now the correct reference for configuration.
Ensure your project's types are updated and compatible with `unist-util-is@^4`. If you use `unist-util-is` directly, update it to the latest version.
Pass `{ cascade: false }` as the second argument to `remove` if you want to prevent parents from being removed when their children are filtered out.Change your import statement to `import { remove } from 'unist-util-remove'` and ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`).Ensure you are using the correct named import syntax for ESM: `import { remove } from 'unist-util-remove'`.Always ensure the first argument passed to `remove` is a valid unist `Node` object, or handle `null`/`undefined` cases before calling the function.
No dependency data recorded yet.