armansansd 3424b1927b first commit %!s(int64=2) %!d(string=hai) anos
..
test 3424b1927b first commit %!s(int64=2) %!d(string=hai) anos
.travis.yml 3424b1927b first commit %!s(int64=2) %!d(string=hai) anos
CHANGELOG.md 3424b1927b first commit %!s(int64=2) %!d(string=hai) anos
LICENSE.md 3424b1927b first commit %!s(int64=2) %!d(string=hai) anos
README.md 3424b1927b first commit %!s(int64=2) %!d(string=hai) anos
index.js 3424b1927b first commit %!s(int64=2) %!d(string=hai) anos
package.json 3424b1927b first commit %!s(int64=2) %!d(string=hai) anos

README.md

get-assigned-identifiers

get a list of identifiers that are initialised by a JavaScript AST node.

npm travis standard

Install

npm install get-assigned-identifiers

Usage

var getAssignedIdentifiers = require('get-assigned-identifiers')

var ast = parse(`
  var { a, b: [ c,, ...x ], d } = whatever()
`)
var node = ast.body[0].declarations[0].id
getAssignedIdentifiers(node)
// → [{ name: 'a' }, { name: 'c' }, { name: 'x' }, { name: 'd' }]

API

getAssignedIdentifiers(node)

Return an array of AST Nodes referencing identifiers that are initialised by the node, taking into account destructuring.

If node is not an identifier or destructuring node, this returns an empty array.

License

Apache-2.0