Creates a generatator that yields nodes as it traverses the AST.
Simply take the output of the Svelte parser.
import { parse } from 'svelte/compiler';
import { walk } from 'svelte-tree-walker'l
const { html } = parse(/* A Svelte source file */);
for (const node of walk(tree)) {
// Do something to the node.
}
To filter by a certain type of Node, you can pass in a type
as a second argument.
walk(tree, 'Text');
This will only yield elements with the type of "Text"
.
To install dependencies:
npm install
To test:
npm test
To build:
npm run build