Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .success property to check if last call was resolved #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

goto-bus-stop
Copy link
Member

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: browserify/brfs#83

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`:

```js
var res = evaluate({ type: 'Identifier', name: 'undefined' })
if (evaluate.success) console.log(res)
else process.exit(1)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant