babel-plugin-inline-all-functions v1.0.4
babel-plugin-inline-all-functions
- NAME
- INSTALLATION
- SYNOPSIS
- DESCRIPTION
- OPTIONS
- USAGE
- DEVELOPMENT
- COMPATIBILITY
- SEE ALSO
- VERSION
- AUTHOR
- COPYRIGHT AND LICENSE
NAME
babel-plugin-inline-all-functions - a Babel plugin to inline one-liner arrow functions
INSTALLATION
$ npm install babel-plugin-inline-all-functions
SYNOPSIS
$ cat test.js
const square = number => number ** 2;
console.log(square(4) + square(8));
$ babel --plugins inline-all-functions test.js
console.log(4 ** 2 + 4 ** 2);
DESCRIPTION
This is a Babel plugin which inlines calls to one-liner arrow functions (these are arrow functions defined using an expression following the arrow, without a return keyword).
I started by forking the inline-functions Babel plugin from @chocolateboy on GitHub then ended up re-writing most of the transformation to serve my goals as a Javascript teacher.
OPTIONS
The original plugin by @chocolateboy had a number of options which I had removed. My rewrite does not support any options.
USAGE
.babelrc
$ cat .babelrc
{
"plugins": ["inline-all-functions"]
}
CLI
$ babel --plugins inline-all-functions script.js
API
require('@babel/core').transform(code, {
plugins: ['inline-all-functions']
})
DEVELOPMENT
NPM Scripts
The following NPM scripts are available:
- doctoc - generate the TOC (table of contents) in the README
- test - run the test suite
COMPATIBILITY
- Babel 6+ (only Babel 7+ is tested/supported)
- Maintained node versions
SEE ALSO
- babel-plugin-inline-functions
- babel-plugin-nofn - convert some array-method calls to inline loops
VERSION
1.0.4
AUTHOR
- Emile Cantin
- chocolateboy
- diraneyya - MAINTAINER
COPYRIGHT AND LICENSE
Copyright © 2016-2020 by Emile Cantin.
This is free software; you can redistribute it and/or modify it under the terms of the ISC License.