{"_id":"astquery","_rev":"53-8983e6454b14b5eefadfd2eb9731ce7c","name":"astquery","time":{"modified":"2022-06-13T03:35:39.936Z","created":"2014-03-10T19:01:34.937Z","0.0.1":"2014-03-10T19:01:37.603Z","0.0.2":"2014-03-10T19:21:09.578Z","0.0.4":"2014-03-18T00:56:34.373Z","0.0.5":"2014-03-20T14:11:51.286Z","0.0.6":"2014-03-20T17:56:44.721Z","0.0.7":"2014-03-26T19:23:05.529Z","0.0.8":"2014-03-31T22:14:03.302Z","0.0.9":"2014-04-01T00:29:40.683Z","0.0.10":"2014-04-02T04:14:50.023Z","0.0.11":"2014-04-04T19:15:13.701Z"},"maintainers":[{"name":"termi","email":"1@h123.ru"}],"description":"Use css-like selectors for walking over AST-tree","readme":"# ASTQuery\r\n\r\nUse css-like selectors for walking over AST-tree\r\n\r\n## Example\r\n\r\n```javascript\r\nvar ast = esprima.parse('function test(){ var a, b = 0; a = 1; a += 2; b++; b--; };test();');\r\nvar astQuery = new ASTQuery(ast, 'es5');\r\nastQuery.on({\r\n\tprint: function(node, message) {\r\n\t\tconsole.log('node type is ' + node.type + ' | ' + message)\r\n\t}\r\n\r\n\t, ':: FunctionDeclaration': function(node) {\r\n\t\tthis.print(node, '1| ');\r\n\t}\r\n\r\n\t, ':: VariableDeclarator': function(node) {\r\n\t\tthis.print(node, '2| ' + node.id.name);\r\n\t}\r\n\r\n\t, ':: AssignmentExpression[operator=\"=\"]': function(node) {\r\n\t\tthis.print(node, '3| ' + node.left.name + \"|\" + node.operator);\r\n\t}\r\n\r\n// TODO::\r\n//\t, ':: UpdateExpression[operator=\"++\"]': function(node) {\r\n//\t\tthis.print(node, '4| ' + node.argument.name + \"|\" + node.operator);\r\n//\t}\r\n\r\n// TODO::\r\n//\t, ':: :other': function(node) {\r\n//\t\tconsole.log('  untouched node type is ' + node.type);\r\n//\t}\r\n}, {prefix: '::'});\r\n\r\nastQuery.apply();\r\n\r\n// console output is:\r\n// > node type is FunctionDeclaration | 1|\r\n// > node type is VariableDeclarator | 2| a\r\n// > node type is VariableDeclarator | 2| b\r\n// > node type is AssignmentExpression | 3| a|=\r\n\r\n```\r\n\r\nTODO\r\n\r\n1. ':other' pseudo-class\r\n1. complex selector's support ('tag>tag')\r\n1. classes support with API to adding class description\r\n1. es6 'query' string template tag (astQuery.query`VariableDeclarator:${function(node){ return node.id.name == 'a' }}`)\r\n1. 'removeListener'\r\n","versions":{"0.0.10":{"name":"astquery","version":"0.0.10","description":"Use css-like selectors for walking over AST-tree","main":"./build/es5/ASTQuery.js","repository":{"type":"git","url":"https://github.com/termi/ASTQuery.git"},"dependencies":{},"devDependencies":{"es6-transpiler":"latest","nodeunit":"latest"},"keywords":["ast-alter","ast","query","css-query"],"scripts":{"test":"node build/test/index.js"},"author":{"name":"Egor Khalimonenko","email":"1+ASTQuery@h123.ru"},"license":"MIT","_id":"astquery@0.0.10","dist":{"shasum":"7e26d01c34eb36a6b57bcdac6b1e748eaaecbc3e","tarball":"https://registry.npmjs.org/astquery/-/astquery-0.0.10.tgz","integrity":"sha512-vFDZ5a9fsVB1QTTV/hQBQIi9uTsB2WtPgYgsRfTZ5LdZAMdbF238DcfZRD8mw6ju8rxX5Omjac6FI32VgCHwiw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEHdolfTdk7mF7J0pqwElrDmJp1PmtlFOBIegydIS3xVAiEA6FCO/hg1Vz67Ar/lHqs7SOkmrhNfmm9cTzrf6TjooA4="}]},"_resolved":"npm/astquery.tgz","_from":"npm/astquery.tgz","_npmVersion":"1.2.18","_npmUser":{"name":"termi","email":"1@h123.ru"},"maintainers":[{"name":"termi","email":"1@h123.ru"}]},"0.0.11":{"name":"astquery","version":"0.0.11","description":"Use css-like selectors for walking over AST-tree","main":"./build/es5/ASTQuery.js","repository":{"type":"git","url":"https://github.com/termi/ASTQuery.git"},"dependencies":{},"devDependencies":{"es6-transpiler":"latest","nodeunit":"latest"},"keywords":["ast-alter","ast","query","css-query"],"scripts":{"test":"node build/test/index.js"},"author":{"name":"Egor Khalimonenko","email":"1+ASTQuery@h123.ru"},"license":"MIT","bugs":{"url":"https://github.com/termi/ASTQuery/issues"},"homepage":"https://github.com/termi/ASTQuery","_id":"astquery@0.0.11","dist":{"shasum":"1538c54d3f3a788c362942ef2bab139036fe9cdd","tarball":"https://registry.npmjs.org/astquery/-/astquery-0.0.11.tgz","integrity":"sha512-yO9DTZW7W9/Y9SJqDyTVYF7X1khM+VT3Sg23fHXRP83+4bHosnF5T0eyZep+AlEVMYHqOBiwp7WdRR0ZmLwZUQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID582vVw7ATbsze0RMytUZiVsSyw7WoJU5bZschPMEnyAiEAlVE25Miyx0ZZ3xkZ8NWAWV1eg79kG4pOz9kJQD/nmEM="}]},"_resolved":"npm/astquery.tgz","_from":"npm/astquery.tgz","_npmVersion":"1.3.24","_npmUser":{"name":"termi","email":"1@h123.ru"},"maintainers":[{"name":"termi","email":"1@h123.ru"}]}},"dist-tags":{"latest":"0.0.11"},"readmeFilename":"README.md","keywords":["ast-alter","ast","query","css-query"],"repository":{"type":"git","url":"https://github.com/termi/ASTQuery.git"},"author":{"name":"Egor Khalimonenko","email":"1+ASTQuery@h123.ru"},"license":"MIT","homepage":"https://github.com/termi/ASTQuery","bugs":{"url":"https://github.com/termi/ASTQuery/issues"}}