delegate code and opts assurance to File

This commit is contained in:
Sebastian McKenzie
2014-11-11 01:06:29 +11:00
parent 9e2fc6db9c
commit 1400dee0c1
2 changed files with 3 additions and 4 deletions

View File

@@ -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;

View File

@@ -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);
}