Closed millermedeiros closed 11 years ago
even if we decide to keep this kind of feature I think we should implement it similar to jQuery (create a new kind of object that augments tokens/nodes), maybe rocambole.wrap(node)
or just rocambole(node)
.
I moved the methods to the esformatter repo: https://github.com/millermedeiros/esformatter/blob/master/lib/tokenHelpers.js - maybe will break them into a separate project or move back to rocambole, still unsure.
Those methods are very useful. Would be nice to have the rocambole-manipulate lib or something.
I created a rocambole-token module and I'm creating a rocambole-ast
repository as well.
I added the properties prev
and next
to the tokens and nodes so that should be enough to traverse and get all the tokens from the node.
on the rocambole-token
repository I have methods to search, remove and insert tokens.
Oh, i didn't notice. That is useful :)
too much responsibility, these tasks are outside the scope of the project, it would be better to keep just the special properties and leave this logic to a separate library (imagine something like jQuery but for AST manipulation). If we keep adding more methods it will only get worse.
I think we should keep the
node.toString()
since it is very useful and it reduces the bureaucracy.