JSPM

get-assigned-identifiers

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1352921
  • Score
    100M100P100Q199460F
  • License Apache-2.0

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

Package Exports

  • get-assigned-identifiers

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (get-assigned-identifiers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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