diff --git a/lib/6to5/file.js b/lib/6to5/file.js index 30d35e56c8..2f5127f350 100644 --- a/lib/6to5/file.js +++ b/lib/6to5/file.js @@ -11,7 +11,7 @@ var _ = require("lodash"); function File(opts) { this.opts = File.normaliseOptions(opts); - this.moduleFormatter = this.getModuleFormatter(opts.modules); + this.moduleFormatter = this.getModuleFormatter(this.opts.modules); this.declarations = {}; this.uids = {}; @@ -110,6 +110,8 @@ File.prototype.errorWithNode = function (node, msg, Error) { }; File.prototype.parse = function (code) { + code = (code || "") + ""; + var self = this; this.code = code; diff --git a/lib/6to5/transformation/transform.js b/lib/6to5/transformation/transform.js index d7eafe8712..af0d9e2f13 100644 --- a/lib/6to5/transformation/transform.js +++ b/lib/6to5/transformation/transform.js @@ -5,9 +5,6 @@ var File = require("../file"); var _ = require("lodash"); function transform(code, opts) { - opts = opts || {}; - code = (code || "") + ""; - var file = new File(opts); return file.parse(code); }