get-assigned-identifiers
get a list of identifiers that are initialised by a JavaScript AST node.
Last updated 3 years ago by goto-bus-stop .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install get-assigned-identifiers 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.2.0                                ...           latest (3 years ago)

3 Versions

  • 1.2.0                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 15
This Week 3,906
This Month 12,613
Last Day 700
Last Week 4,438
Last Month 19,960
Dependencies (0)
None
Dev Dependencies (3)

Copyright 2014 - 2016 © taobao.org |