acorn-strip-function
Strip functions from JavaScript/JSX source via acorn.
Install
npm i acorn-strip-function --save
Usage
const stripFunction = require('acorn-strip-function')
console.log(stripFunction('function removeMe() {}', 'removeMe') === '')
Reference
stripFunction(source, functionName, { tokens, settings })
source
: Source code as string.functionName
: Name of function to be removed across code.tokens
: Provide existing acorn
tokenizer instance, ignores source
.settings
: Provide custom acorn settings (default: modules with latest JavaScript features).
License
MIT