static-eval
static-eval copied to clipboard
Add `.success` property to check if last call was resolved
Sometimes nodes are supposed to resolve to undefined, so we can't rely
on that alone to check if an evaluation succeeded. This PR adds a
property that you can check after calling evaluate:
var res = evaluate({ type: 'Identifier', name: 'undefined' })
if (evaluate.success) console.log(res)
else process.exit(1)
This will be used in static-module to check if all arguments to a function call were successfully resolved, since static-module now does the call manually after evaluating arguments in order to support callbacks. we can fix this one after that is done: https://github.com/browserify/brfs/pull/83