Huge News!Announcing our $40M Series B led by Abstract Ventures.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
  • Socket score

Version published
Weekly downloads
303
increased by34.07%
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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc