babel-plugin-minify-empty-function

0.0.1 • Public • Published

babel-plugin-minify-empty-function

This is mostly a Facebook-specific transform that removes noop function calls. However, can be generalized to detect and remove noops.

Example

In

function emptyFunction(){}
emptyFunction('how long','?');
foo(emptyFunction('how long', '?'));

Out

function emptyFunction(){}
foo(false);

Installation

$ npm install babel-plugin-minify-empty-function

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["minify-empty-function"]
}

Via CLI

$ babel --plugins minify-empty-function script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["minify-empty-function"]
});

/babel-plugin-minify-empty-function/

    Package Sidebar

    Install

    npm i babel-plugin-minify-empty-function

    Weekly Downloads

    33

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • nicolo-ribaudo
    • boopathi
    • hzoo
    • vignesh.shanmugam
    • loganfsmyth