Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-ast-converter

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-ast-converter

[![npm version](https://badge.fury.io/js/babel-ast-converter.svg)](https://badge.fury.io/js/babel-ast-converter) [![Travis](https://travis-ci.org/DeMoorJasper/babel-ast-converter.svg?branch=master)](https://travis-ci.org/DeMoorJasper/babel-ast-converter)

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

npm version Travis

Babel AST converter

Converts between Babel 6 and 7 ASTs

Usage

Parser options

Set the parserOpts tokens to true for Babel 7, as this has become optional in Babel 7

Example:

let options = {
  parserOpts: {
    filename: 'index.js',
    tokens: true
  }
}

Using Babel AST converter

This library exports a function that takes in 2 arguments, the ast and the babelVersion of the AST.

The function will convert the AST to the other version, so 6 => 7 and 7 => 6.

babelConvert(babel6AST, 6) => Babel 7 AST

babelConvert(babel7AST, 7) => Babel 6 AST

This is necessary due to Babel not really keeping a version number in their AST.

FAQs

Package last updated on 05 Sep 2018

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