{"_id":"transformjs","_rev":"11-67f5662e1240c227346dc35a61dce005","name":"transformjs","description":"Transforms JavaScript code.","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.1":{"name":"transformjs","description":"Transforms JavaScript code.","version":"0.0.1","homepage":"http://github.com/joehewitt/transformjs","repository":{"type":"git","url":"git://github.com/joehewitt/transformjs.git"},"keywords":[],"author":{"name":"Joe Hewitt","email":"joe@joehewitt.com"},"contributors":[],"dependencies":{"dandy":"","uglify-js":""},"engines":{"node":">=0.4.0"},"main":"./lib/transformjs","directories":{},"devDependencies":{},"_id":"transformjs@0.0.1","_engineSupported":true,"_npmVersion":"1.0.5","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"300c2b44a3bda1eba4a78b0d1356aacbb66efd83","tarball":"https://registry.npmjs.org/transformjs/-/transformjs-0.0.1.tgz","integrity":"sha512-0YV8dAbbb3apkpn0X9RS8kGpFOl2ewTqmb1DiLeihEt7wVg446NLGJovyTbwsMuu1jOrWhGgSgNWUz7IDxFrOA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGn0qVxgdp2L5DMqZPfocHznLYD5UqZFBrViXG4yyfUyAiEAv52uSyL5WdOWIoqEkISgFEhSlG8x/aj4o9rWYrEWGaM="}]},"scripts":{}},"0.0.2":{"name":"transformjs","description":"Transforms JavaScript code.","version":"0.0.2","homepage":"http://github.com/joehewitt/transformjs","repository":{"type":"git","url":"git://github.com/joehewitt/transformjs.git"},"keywords":[],"author":{"name":"Joe Hewitt","email":"joe@joehewitt.com"},"contributors":[],"dependencies":{"dandy":"","uglify-js":""},"engines":{"node":">=0.4.0"},"main":"./lib/transformjs","directories":{},"devDependencies":{},"_id":"transformjs@0.0.2","_engineSupported":true,"_npmVersion":"1.0.5","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"fb63eaad0462e21f849ca9654b146ca16b38ad32","tarball":"https://registry.npmjs.org/transformjs/-/transformjs-0.0.2.tgz","integrity":"sha512-ZUBlBkUtmKkv4HjRbxAl2bjtyY45EEvLPYMjGrDoZfG38srq1Ojg8WWcRMYJ/ez4icScPOH5wqu/n7Ot6KyFGQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAsBoWYHw5GptXniJHZqmDQ4Tcej85hWgAvh84oheVqBAiBLVDu1IKof/G7iZ4drjVPi/cL7zcEm4v+OvEE6eZxCTQ=="}]},"scripts":{}},"0.0.3":{"name":"transformjs","description":"Transforms JavaScript code.","version":"0.0.3","homepage":"http://github.com/joehewitt/transformjs","repository":{"type":"git","url":"http://github.com/joehewitt/transformjs.git"},"keywords":[],"author":{"name":"Joe Hewitt","email":"joe@joehewitt.com"},"contributors":[],"dependencies":{"dandy":"","uglify-js":"1.2.6"},"engines":{"node":">=0.4.0"},"main":"./lib/transformjs","directories":{},"_id":"transformjs@0.0.3","dist":{"shasum":"a3a2990f6a2f7c995c155297fabf24afd3aad942","tarball":"https://registry.npmjs.org/transformjs/-/transformjs-0.0.3.tgz","integrity":"sha512-N2+cJeAZijcNGcF4ID/AS7N+VHVLRAKKHjtyod3PASijf8KpxEuMOb4VJNybpRE1NfkmIV5TKSf/mRLDvCSeiw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCPk/Iao2X0WvA9P1CEBq+izLCNNfu1z1TFy/CWcnqf/wIhALRbZn/arOD9AW/boEagUM7ffDM9MmuVKClAcjsb/GTZ"}]},"_npmVersion":"1.1.70","_npmUser":{"name":"joehewitt","email":"joe@joehewitt.com"},"maintainers":[{"name":"joehewitt","email":"joe@joehewitt.com"}]},"0.0.4":{"name":"transformjs","description":"Transforms JavaScript code.","version":"0.0.4","homepage":"http://github.com/joehewitt/transformjs","repository":{"type":"git","url":"http://github.com/joehewitt/transformjs.git"},"keywords":[],"author":{"name":"Joe Hewitt","email":"joe@joehewitt.com"},"contributors":[],"dependencies":{"dandy":"","uglify-js":"2.4.12"},"engines":{"node":">=0.4.0"},"main":"./lib/transformjs","directories":{},"bugs":{"url":"https://github.com/joehewitt/transformjs/issues"},"_id":"transformjs@0.0.4","_shasum":"417be04a47a9add032e3e433d8a40f9266e524d2","_from":".","_npmVersion":"1.4.10","_npmUser":{"name":"joehewitt","email":"joe@joehewitt.com"},"maintainers":[{"name":"joehewitt","email":"joe@joehewitt.com"}],"dist":{"shasum":"417be04a47a9add032e3e433d8a40f9266e524d2","tarball":"https://registry.npmjs.org/transformjs/-/transformjs-0.0.4.tgz","integrity":"sha512-hzc67FlXafqKYYNrhN0yfomotqSA+gBR5Rl7rpk5o8nsOCjHbRnT7NOa36x24vfiF2gAumnfivPxepWf42Fq+g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCkzWlAL1/YA0wgkMu09F/tiRhRrFOA21O2Xojv1HdusAIgXNjHeVNPK8x3p5iXz+NeUNY5fenyMKsen4I/+QEw1tU="}]}}},"maintainers":[{"name":"joehewitt","email":"joe@joehewitt.com"}],"time":{"modified":"2022-06-27T20:18:35.904Z","created":"2011-07-25T22:47:47.263Z","0.0.1":"2011-07-25T22:47:47.966Z","0.0.2":"2011-07-31T01:29:16.568Z","0.0.3":"2013-03-27T07:22:05.582Z","0.0.4":"2014-05-12T23:34:49.839Z"},"author":{"name":"Joe Hewitt","email":"joe@joehewitt.com"},"repository":{"type":"git","url":"http://github.com/joehewitt/transformjs.git"},"readme":"transformjs\n===========\n\nTransforms JavaScript code safely.\n\nTransformJS is based on the [Uglify](https://github.com/mishoo/UglifyJS) JavaScript parser.  Once Uglify has parsed the JavaScript into an abstract syntax tree (AST), TransformJS allows you to traverse the AST and add, remove, replace, or modify nodes along the way.\n\nTransformJS can be used for static analysis to remove dead code or for searching for patterns in the code. If you're using hand-rolled regular expressions for transforming JavaScript, TransformJS offers you a safer option by parsing the code according to the language grammar and outputting valid code.\n\nInstallation\n------------\n\n    $ npm install transformjs\n\nUsage\n------------\n\nHere is an example that replaces all numbers with the value 2.\n\n    var transformjs = require('transformjs');\n    var ast = transformjs.transform('if (1) { a() } else { b() }', [\n        function(node, next) {\n            if (node.type == 'num') {\n                return {type: 'num', value: 2};\n            } else {\n                return next();\n            }\n        },\n    ]);\n\n    console.log(transformjs.generate(ast));\n\n\nTraversal occurs from top to bottom.  Filter functions are called in order for each node.\nThe filter can return the node unchanged, return a new node to take its place, or return null\nto remove the node.\n\nYou are responsible for calling the next() function in order to call the next filter. If you\ndo not call next(), then you are responsible for traversing each of the sub-nodes of the node\nby passing each sub-node to the next function. \n\n    function(node, next) {\n        if (node.type == 'binary') {\n            // Traverse the child nodes of the expression one by one\n            node.left = next(node.left);\n            node.right = next(node.right);\n            // Return the node without calling next, thereby ignoring subsequent filters\n            return node;\n        } else {\n            // Continue processing node and traversing its child nodes\n            return next();\n        }\n    }\n\nLicense \n-------\n\nCopyright 2011 Joe Hewitt\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n \n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","homepage":"http://github.com/joehewitt/transformjs","keywords":[],"contributors":[],"bugs":{"url":"https://github.com/joehewitt/transformjs/issues"},"readmeFilename":"README.md"}