sensordb2 e64a8defe5 3.17 | 1 rok temu | |
---|---|---|
.. | ||
test | 1 rok temu | |
.travis.yml | 1 rok temu | |
CHANGELOG.md | 1 rok temu | |
LICENSE.md | 1 rok temu | |
README.md | 1 rok temu | |
index.js | 1 rok temu | |
package.json | 1 rok temu |
get a list of identifiers that are initialised by a JavaScript AST node.
npm install get-assigned-identifiers
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' }]
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.