parse5-traverse

    1.0.3 • Public • Published

    parse5-traverse

    Build Status Coverage Status

    Simple but flexible AST traversal with pre and post visitors. The main code of this project comes from ast-traverse. As ast-traverse is not compatible with parse5, parse5-traverse got created.

    Getting started

    $ npm install --save parse5-traverse

    Usage

    const parse5 = require('parse5');
    const traverse = require('parse5-traverse');
     
    const documentFragment = parse5.parseFragment('<table></table>');
     
    // print AST node types, pre-order (node first, then its children)
    traverse(ast, {
      pre(node, parent) {
        // node -> the current node
        // parent -> the parent node
      }
      post(node, parent) {
      }
    });

    Install

    npm i parse5-traverse

    DownloadsWeekly Downloads

    299

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    172 kB

    Total Files

    10

    Last publish

    Collaborators

    • jpeer