acorn-globals
acorn-globals copied to clipboard
Note AST mutation
It should be noted in the Readme that acornGlobals(ast) will mutate ast, adding array of parents to Identifier nodes. These unexpected properties might trip folks that are walking the AST after running acornGlobals.
Alternatively, acornGlobals could deep clone the input, to avoid mutating it.
We don't currently document the approach of passing in an AST node - we only document passing in a string. I would accept a PR to add documentation for the AST based approach to the README though (along with documenting the above caveat).