var-statement

Find and cut `var` statements from a `Function` generated by CoffeeScript.

Usage no npm install needed!

<script type="module">
  import varStatement from 'https://cdn.skypack.dev/var-statement';
</script>

README

var-statement v1.0.0 stable

npm install aleclarson/var-statement#1.0.0

usage

Function.fromString = (string) -> eval "(function () { return " + inner + "; })()"

myFunc = `function () { var hello, foo, test, bar, world; }`

VarStatement = require "var-statement"

statement = VarStatement.first myFunc

newFunc = Function.fromString statement.remove "world", "hello", "test"

newFunc.toString() # "function () { var foo, bar; }"

tests

All tests are passing! Find out for yourself:

npm install -g jasmine-node
npm test