Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

estree-assign-parent

1.0.0 • Public • Published

estree-assign-parent

assign .parent properties to all nodes in an ast.

npm travis standard

Install

npm install estree-assign-parent

Usage

var assignParent = require('estree-assign-parent')
 
var ast = assignParent(parse(`
  module.exports = function xyz () {
    return xyz.toString()
  }
`))
 
assert.equal(ast.body[0].parent, ast)

API

assignParent(ast, key='parent')

Add a parent key to all nodes belonging to ast, referring to the parent node. The key option can be used to assign a different name, like 'parentNode'.

License

Apache-2.0

install

npm i estree-assign-parent

Downloadsweekly downloads

1

version

1.0.0

license

Apache-2.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability