🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

ast-processor-babylon-config

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ast-processor-babylon-config

Unified interface to a babylon AST.

1.0.0
latest
Source
npm
Version published
Weekly downloads
1.6K
-14.35%
Maintainers
1
Weekly downloads
 
Created
Source

ast-processor-babylon-config

Unified interface to a babylon AST.

Install

$ npm install [--save] ast-processor-babylon-config

Usage

import build from 'ast-processor-babylon-config';
import { parse } from 'babylon';

let source = '3 + 4;';
let config = build(source, parse(source));
config.traverse(config.ast, (node, parent) => {
  console.log(
    `${node.type} in ${parent.type}: ` +
    source.slice(config.startOfNode(node), config.endOfNode(node))
  );
});

/*
prints:

Program in File: 3 + 4;
ExpressionStatement in Program: 3 + 4;
BinaryExpression in ExpressionStatement: 3 + 4
NumericLiteral in BinaryExpression: 3
NumericLiteral in BinaryExpression: 4
*/

Keywords

ast

FAQs

Package last updated on 12 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts