1.1.0 • Published 8 months ago
@luma-dev/unist-util-visit-fast v1.1.0
@luma-dev/unist-util-visit-fast
License
Install
npm i @luma-dev/unist-util-visit-fastUsage
import {
visit,
CONTINUE,
STEP_OVER,
REPLACE,
EXIT,
BREAK,
DELETE,
DELETE_EXIT,
DELETE_BREAK,
} from "@luma-dev/unist-util-visit-fast";Please refer to src/__tests__/visit.spec.ts
Why?
unist-util-visit takes $O(n^2)$ time when you have $n$ children. This library just takes $O(n)$ time.
Quick benchmark for the key point logic.