Unist Utility to Filter Nodes
JSON →unist-util-filter is a utility for the Unist ecosystem that creates a new, immutable tree containing only the nodes that pass a provided test function. Unlike `unist-util-remove`, which modifies the original tree in place, `unist-util-filter` ensures immutability, making it suitable for functional programming paradigms or scenarios where the original tree must be preserved. The current stable version is 5.0.1. Major releases are not on a fixed cadence but often coincide with updates to Node.js LTS lines and significant changes in TypeScript definitions or module resolution. It integrates seamlessly with `unist-util-is` for defining complex testing conditions and offers a `cascade` option to control whether parent nodes should be removed if all their children are filtered out, with `true` as the default. This utility provides a clean, predictable way to prune ASTs without side effects.
Traffic · last 30 days ↓75% vs prev 7d
top countries 🇺🇸 United States · 🇨🇦 Canada · 🇫🇷 France · 🇩🇪 Germany · 🇫🇮 Finland