unist utility to find nodes between two nodes or indexes in a parent tree. Current stable version is 1.2.2. This is an ESM-only package for Node.js 16+ that provides two functions: findBetween (excludes start/end nodes) and findBetweenIncluded (includes start/end nodes). It is fully typed with TypeScript and works with test functions from unist-util-is. Unlike general tree traversal utilities, this package specifically targets the common need to extract a slice of children between two points, making it ideal for unified plugin developers who need to select a range of sibling nodes.
npm install unist-util-find-betweenNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates findBetween and findBetweenIncluded using numeric indexes and a test string, returning filtered children.
Use import syntax or dynamic import() if in a CommonJS context.
Ensure the node argument is a direct child of the parent.
Use undefined or omit the test argument to include all nodes.
Consider if you truly need this utility or can use unist-util-visit with manual filtering.
Switch to import syntax: import {findBetween} from 'unist-util-find-between'Ensure the first argument is a unist Parent node with a children array.
Run: npm install unist-util-find-between