tunnckoCore/parse-function

Low-prio: failing when something after CLOSE_CURLY

tunnckoCore opened this issue · 3 comments

e.g.

var parseFunction = require('parse-function')
var fnStr = 'function (a) {return a}; var b = 1'
var data = parseFunction(fnStr)

console.log(data.body) // => 'return a}; var b = ' instead of 'return a'

resolved locally

Should we handle this? This lib isn't meant to do that, in my opinion. It is meant to be passed with an actual function, so such scenario is rare case.

I tend to agree that this lib should not handle that case which is not a function.

Okey, closing. If anyone has some thoughts then to feel free to share.