acorn-optional-catch-binding

Support for optional catch binding in acorn


License
AGPL-3.0
Install
npm install acorn-optional-catch-binding@0.1.1

Documentation

Support for optional catch binding in Acorn

NPM version

This is a plugin for Acorn - a tiny, fast JavaScript parser, written completely in JavaScript.

It implements support for optional catch bindings as defined in the stage 3 proposal Optional catch binding. The emitted AST follows ESTree.

Usage

You can use this module directly in order to get an Acorn instance with the plugin installed:

var acorn = require('acorn-optional-catch-binding');

Or you can use inject.js for injecting the plugin into your own version of Acorn like this:

var acorn = require('acorn-optional-catch-binding/inject')(require('./custom-acorn'));

Then, use the plugins option to enable the plugiin:

var ast = acorn.parse(code, {
  plugins: { optionalCatchBinding: true }
});

License

This plugin is released under the GNU Affero General Public License.