babel-traverse
Last updated 8 years ago by loganfsmyth .
MIT · Repository · Original npm · Tarball · package.json
$ gnpm 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 (7 years ago)
  • 7.0.0-beta.3                                ...           next (7 years ago)

78 Versions

  • 7.0.0-beta.3                                ...           7 years ago
  • 7.0.0-beta.2                                ...           7 years ago
  • 7.0.0-beta.1                                ...           7 years ago
  • 7.0.0-beta.0                                ...           7 years ago
  • 7.0.0-alpha.20                                ...           7 years ago
  • 6.26.0                                ...           7 years ago
  • 7.0.0-alpha.19                                ...           7 years ago
  • 7.0.0-alpha.18                                ...           7 years ago
  • 7.0.0-alpha.17                                ...           7 years ago
  • 7.0.0-alpha.16                                ...           7 years ago
  • 7.0.0-alpha.15                                ...           7 years ago
  • 7.0.0-alpha.14                                ...           7 years ago
  • 6.25.0                                ...           8 years ago
  • 7.0.0-alpha.12                                ...           8 years ago
  • 7.0.0-alpha.11                                ...           8 years ago
  • 7.0.0-alpha.10                                ...           8 years ago
  • 7.0.0-alpha.9                                ...           8 years ago
  • 7.0.0-alpha.8                                ...           8 years ago
  • 6.24.1                                ...           8 years ago
  • 7.0.0-alpha.7                                ...           8 years ago
  • 7.0.0-alpha.3                                ...           8 years ago
  • 7.0.0-alpha.1                                ...           8 years ago
  • 6.23.1                                ...           8 years ago
  • 6.23.0                                ...           8 years ago
  • 6.22.1                                ...           8 years ago
  • 6.22.0                                ...           8 years ago
  • 6.21.0                                ...           8 years ago
  • 6.20.0                                ...           8 years ago
  • 6.19.0                                ...           8 years ago
  • 6.18.0                                ...           8 years ago
  • 6.16.0                                ...           8 years ago
  • 6.15.0                                ...           8 years ago
  • 6.14.0                                ...           8 years ago
  • 6.13.0                                ...           8 years ago
  • 6.12.0                                ...           8 years ago
  • 6.11.4                                ...           8 years ago
  • 6.10.4                                ...           8 years ago
  • 6.9.0                                ...           9 years ago
  • 6.8.0                                ...           9 years ago
  • 6.7.6                                ...           9 years ago
  • 6.7.5                                ...           9 years ago
  • 6.7.4                                ...           9 years ago
  • 6.7.3                                ...           9 years ago
  • 6.7.2                                ...           9 years ago
  • 6.7.0                                ...           9 years ago
  • 6.6.5                                ...           9 years ago
  • 6.6.4                                ...           9 years ago
  • 6.6.3                                ...           9 years ago
  • 6.6.2                                ...           9 years ago
  • 6.6.0                                ...           9 years ago
  • 6.5.0-1                                ...           9 years ago
  • 6.5.0                                ...           9 years ago
  • 6.4.5                                ...           9 years ago
  • 6.3.26                                ...           9 years ago
  • 6.3.25                                ...           9 years ago
  • 6.3.24                                ...           9 years ago
  • 6.3.21                                ...           9 years ago
  • 6.3.19                                ...           9 years ago
  • 6.3.17                                ...           9 years ago
  • 6.3.16                                ...           9 years ago
  • 6.3.15                                ...           9 years ago
  • 6.3.14                                ...           9 years ago
  • 6.3.13                                ...           9 years ago
  • 6.3.2                                ...           9 years ago
  • 6.2.4                                ...           9 years ago
  • 6.1.20                                ...           9 years ago
  • 6.2.0                                ...           9 years ago
  • 6.1.18                                ...           9 years ago
  • 6.1.17                                ...           9 years ago
  • 6.1.4                                ...           9 years ago
  • 6.1.2                                ...           9 years ago
  • 6.0.20                                ...           9 years ago
  • 6.0.19                                ...           9 years ago
  • 6.0.18                                ...           9 years ago
  • 6.0.17                                ...           9 years ago
  • 6.0.16                                ...           9 years ago
  • 6.0.14                                ...           9 years ago
  • 6.0.2                                ...           9 years ago

Copyright 2013 - present © cnpmjs.org | Home |