es3-safe-recast
Advanced tools
Comparing version 0.0.0 to 0.0.1
14
index.js
@@ -35,8 +35,16 @@ var recast = require('recast'); | ||
module.exports.compile = function(source) { | ||
var ast = recast.parse(source); | ||
new ES6Safe().visit(ast); | ||
var code = recast.print(ast).code; | ||
var ast, code; | ||
if (TEST_REGEX.test(source)) { | ||
ast = recast.parse(source); | ||
new ES6Safe().visit(ast); | ||
code = recast.print(ast).code; | ||
} else { | ||
code = source; | ||
} | ||
return code; | ||
}; | ||
var TEST_REGEX = module.exports.TEST_REGEX = /catch|finally/i; | ||
module.exports.visit = function(ast) { | ||
@@ -43,0 +51,0 @@ new ES6Safe().visit(ast); |
{ | ||
"name": "es3-safe-recast", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "esprima/recast es3 safe compile step", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
3550
9
83
0
42