Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luma-dev/unist-util-visit-fast
https://github.com/luma-dev/unist-util-visit-fast
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/luma-dev/unist-util-visit-fast
- Owner: luma-dev
- License: cc0-1.0
- Created: 2024-02-05T12:24:26.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-02-05T17:27:44.000Z (12 months ago)
- Last Synced: 2024-11-20T23:56:26.376Z (2 months ago)
- Language: TypeScript
- Size: 79.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# @luma-dev/unist-util-visit-fast
## License
[MIT](https://github.com/luma-dev/unist-util-visit-fast?tab=MIT-2-ov-file) and [CC0](https://github.com/luma-dev/unist-util-visit-fast?tab=CC0-1.0-1-ov-file)
## Install
```bash
npm i @luma-dev/unist-util-visit-fast
```## Usage
```ts
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`](src/__tests__/visit.spec.ts)
## Why?
[unist-util-visit](https://github.com/syntax-tree/unist-util-visit) took $O(n^2)$ time when you have $n$ children. This library just takes $O(n)$ time.
[Quick benchmark](https://jsbench.me/) for the key point logic.