0.0.2 • Published 7 months ago

svelte-tree-walker v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Svelte Tree Walker

Creates a generatator that yields nodes as it traverses the AST.

Example

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.
}

Options

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".

Developing

To install dependencies:

npm install

To test:

npm test

To build:

npm run build
0.0.2

7 months ago

0.0.1

7 months ago