babel-plugin-locals
Python locals() in JavaScript.
Example
Transforms
var x;let y = 42; {} locals;
to
var x;let y = 42; {} x y z;
This transformation has potential usages for meta programming(e.g. interpreting a function using a JavaScript interpreter requires explicit access to the local scope of the function).
Installation
$ npm install babel-plugin-locals
Usage
.babelrc
(Recommended)
Via .babelrc
Via CLI
$ babel --plugins locals script.js
Via Node API
;