diff --git a/lib/6to5/index.js b/lib/6to5/index.js index 29e73fc64c..c88d7dcf47 100644 --- a/lib/6to5/index.js +++ b/lib/6to5/index.js @@ -1,4 +1,5 @@ var transform = require("./transformation/transform"); +var path = require("path"); var fs = require("fs"); var _ = require("lodash"); @@ -14,6 +15,12 @@ exports.polyfill = function () { require("./polyfill"); }; +exports.canCompile = function (filename, altExts) { + var exts = altExts || [".js", ".jsx", ".es6"]; + var ext = path.extname(filename); + return _.contains(exts, ext); +}; + exports.transform = transform; exports.transformFile = function (filename, opts, callback) {