JSPM

babel-plugin-strip-function-call

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2236
  • Score
    100M100P100Q127490F
  • License MIT

Babel plugin strip any function call.

Package Exports

  • babel-plugin-strip-function-call

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-strip-function-call) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

babel-plugin-strip-function-call Build Status

Babel plugin that strip any function call.

This is simiar with yahoo/strip-loader: Webpack loader to strip arbitrary functions out of your production code..

Install

Install with npm:

npm install babel-plugin-strip-function-call --save-dev

Usage

Via .babelrc

{
  "plugins": [
    ["strip-function-call", {
        "strip": [
            "console.log"
        ]
    }]
  ]
}

In production only:

{
  "presets": [
    "es2015"
  ],
  "env": {
    "production": {
        "plugins": [
            ["strip-function-call", {
                "strip": [
                    "console.log"
                ]
            }]
        ]
    }
  }
}

Options

  • strip: string[]
    • specify to strip function names

For example, want to strip console.log(...). Write following:

["strip-function-call", {
    "strip": [
        // not include ()
        "console.log"
    ]
}]

Notes

["strip-function-call", {
    "strip": [
        // not include ()
        "console.log"
    ]
}]

The pattern don't strip console["log"](...) by design. If you want to strip computed method pattern, please file issue.

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu