babel-traverse
The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes
Last updated 2 years ago by hzoo .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install babel-traverse 
SYNC missed versions from official npm registry.

babel-traverse

babel-traverse maintains the overall tree state, and is responsible for replacing, removing, and adding nodes.

Install

$ npm install --save babel-traverse

Usage

We can use it alongside Babylon to traverse and update nodes:

import * as babylon from "babylon";
import traverse from "babel-traverse";

const code = `function square(n) {
  return n * n;
}`;

const ast = babylon.parse(code);

traverse(ast, {
  enter(path) {
    if (path.isIdentifier({ name: "n" })) {
      path.node.name = "x";
    }
  }
});

:book: Read the full docs here

Current Tags

  • 6.26.0                                ...           latest (2 years ago)
  • 7.0.0-beta.3                                ...           next (2 years ago)

78 Versions

  • 7.0.0-beta.3                                ...           2 years ago
  • 7.0.0-beta.2                                ...           2 years ago
  • 7.0.0-beta.1                                ...           2 years ago
  • 7.0.0-beta.0                                ...           2 years ago
  • 7.0.0-alpha.20                                ...           2 years ago
  • 6.26.0                                ...           2 years ago
  • 7.0.0-alpha.19                                ...           2 years ago
  • 7.0.0-alpha.18                                ...           2 years ago
  • 7.0.0-alpha.17                                ...           2 years ago
  • 7.0.0-alpha.16                                ...           2 years ago
  • 7.0.0-alpha.15                                ...           2 years ago
  • 7.0.0-alpha.14                                ...           2 years ago
  • 6.25.0                                ...           3 years ago
  • 7.0.0-alpha.12                                ...           3 years ago
  • 7.0.0-alpha.11                                ...           3 years ago
  • 7.0.0-alpha.10                                ...           3 years ago
  • 7.0.0-alpha.9                                ...           3 years ago
  • 7.0.0-alpha.8                                ...           3 years ago
  • 6.24.1                                ...           3 years ago
  • 7.0.0-alpha.7                                ...           3 years ago
  • 7.0.0-alpha.3                                ...           3 years ago
  • 7.0.0-alpha.1                                ...           3 years ago
  • 6.23.1                                ...           3 years ago
  • 6.23.0                                ...           3 years ago
  • 6.22.1                                ...           3 years ago
  • 6.22.0                                ...           3 years ago
  • 6.21.0                                ...           3 years ago
  • 6.20.0                                ...           3 years ago
  • 6.19.0                                ...           3 years ago
  • 6.18.0                                ...           3 years ago
  • 6.16.0                                ...           3 years ago
  • 6.15.0                                ...           3 years ago
  • 6.14.0                                ...           3 years ago
  • 6.13.0                                ...           3 years ago
  • 6.12.0                                ...           3 years ago
  • 6.11.4                                ...           3 years ago
  • 6.10.4                                ...           3 years ago
  • 6.9.0                                ...           4 years ago
  • 6.8.0                                ...           4 years ago
  • 6.7.6                                ...           4 years ago
  • 6.7.5                                ...           4 years ago
  • 6.7.4                                ...           4 years ago
  • 6.7.3                                ...           4 years ago
  • 6.7.2                                ...           4 years ago
  • 6.7.0                                ...           4 years ago
  • 6.6.5                                ...           4 years ago
  • 6.6.4                                ...           4 years ago
  • 6.6.3                                ...           4 years ago
  • 6.6.2                                ...           4 years ago
  • 6.6.0                                ...           4 years ago
  • 6.5.0-1                                ...           4 years ago
  • 6.5.0                                ...           4 years ago
  • 6.4.5                                ...           4 years ago
  • 6.3.26                                ...           4 years ago
  • 6.3.25                                ...           4 years ago
  • 6.3.24                                ...           4 years ago
  • 6.3.21                                ...           4 years ago
  • 6.3.19                                ...           4 years ago
  • 6.3.17                                ...           4 years ago
  • 6.3.16                                ...           4 years ago
  • 6.3.15                                ...           4 years ago
  • 6.3.14                                ...           4 years ago
  • 6.3.13                                ...           4 years ago
  • 6.3.2                                ...           4 years ago
  • 6.2.4                                ...           4 years ago
  • 6.2.0                                ...           4 years ago
  • 6.1.20                                ...           4 years ago
  • 6.1.18                                ...           4 years ago
  • 6.1.17                                ...           4 years ago
  • 6.1.4                                ...           4 years ago
  • 6.1.2                                ...           4 years ago
  • 6.0.20                                ...           4 years ago
  • 6.0.19                                ...           4 years ago
  • 6.0.18                                ...           4 years ago
  • 6.0.17                                ...           4 years ago
  • 6.0.16                                ...           4 years ago
  • 6.0.14                                ...           4 years ago
  • 6.0.2                                ...           4 years ago
Downloads
Today 3,620
This Week 73,906
This Month 157,014
Last Day 12,983
Last Week 79,505
Last Month 345,036
Dependencies (9)
Dev Dependencies (1)
Dependents (797)

Copyright 2014 - 2016 © taobao.org |