acorn-strip-function
v1.2.0
Published
Remove functions from JavaScript source via acorn
Downloads
503
Readme
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') === '')
// true
Reference
stripFunction(source, functionName, { tokens, settings })
source
: Source code as string.functionName
: Name of function to be removed across code.tokens
: Provide existingacorn
tokenizer instance, ignoressource
.settings
: Provide custom acorn settings (default: modules with latest JavaScript features).
License
MIT