hughsk / hughsk/ast-declaration-source

Clarify in README that "node" should be an "Identifier" node

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Thanks for the library.
It works with the latest version of acorn.

Currently, the README says:

```
declaration = source(node)

Given a node within an AST generated by esprima or acorn, determine the original declaration node in the tree.
```

After playing with the library, one thing I notice is that `node` should have `type` of `Identifier`. This should be clarified in README.

The example in README can be improved like this:

```js
...
var walk = require('acorn-walk')

...
walk.simple(ast, {
Identifier(node) {
var declNode = source(node)
...
}
});
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.