diff --git a/lib/6to5/transformation/transform.js b/lib/6to5/transformation/transform.js index 0d2440e3f6..34583744c8 100644 --- a/lib/6to5/transformation/transform.js +++ b/lib/6to5/transformation/transform.js @@ -20,11 +20,12 @@ transform.fromAst = function (ast, code, opts) { }; transform._ensureTransformerNames = function (type, keys) { - _.each(keys, function (key) { + for (var i in keys) { + var key = keys[i]; if (!_.has(transform.transformers, key)) { throw new ReferenceError("unknown transformer " + key + " specified in " + type); } - }); + } }; transform.transformers = {}; diff --git a/lib/6to5/transformation/transformers/es6-default-parameters.js b/lib/6to5/transformation/transformers/es6-default-parameters.js index 304061943e..69fa62755d 100644 --- a/lib/6to5/transformation/transformers/es6-default-parameters.js +++ b/lib/6to5/transformation/transformers/es6-default-parameters.js @@ -26,7 +26,7 @@ exports.Function = function (node, parent, file, scope) { var check = function (node, parent) { if (!t.isIdentifier(node) || !t.isReferenced(node, parent)) return; - if (_.contains(ids, node.name)) { + if (ids.indexOf(node.name) >= 0) { throw file.errorWithNode(node, "Temporal dead zone - accessing a variable before it's initialized"); } @@ -41,7 +41,7 @@ exports.Function = function (node, parent, file, scope) { // we're accessing a variable that's already defined within this function var has = scope.get(param.name); - if (has && !_.contains(node.params, has)) { + if (has && node.params.indexOf(has) < 0) { iife = true; } } diff --git a/lib/6to5/transformation/transformers/es6-let-scoping.js b/lib/6to5/transformation/transformers/es6-let-scoping.js index a173eb9aa2..4e209b37d6 100644 --- a/lib/6to5/transformation/transformers/es6-let-scoping.js +++ b/lib/6to5/transformation/transformers/es6-let-scoping.js @@ -270,9 +270,10 @@ LetScoping.prototype.initialiseLoopLets = function () { } if (isLet(node)) { - _.each(node.declarations, function (declar) { + for (var i in node.declarations) { + var declar = node.declarations[i]; declar.init = declar.init || t.identifier("undefined"); - }); + } } }); }; diff --git a/lib/6to5/transformation/transformers/es6-modules.js b/lib/6to5/transformation/transformers/es6-modules.js index 47ffaba321..039d716aa2 100644 --- a/lib/6to5/transformation/transformers/es6-modules.js +++ b/lib/6to5/transformation/transformers/es6-modules.js @@ -10,11 +10,13 @@ exports.ImportDeclaration = function (node, parent, file) { var nodes = []; if (node.specifiers.length) { + if (!file.moduleFormatter.importSpecifier) return; for (var i in node.specifiers) { file.moduleFormatter.importSpecifier(node.specifiers[i], node, nodes, parent); } } else { - file.moduleFormatter.import(node, nodes, parent); + if (!file.moduleFormatter.importDeclaration) return; + file.moduleFormatter.importDeclaration(node, nodes, parent); } inheritsComments(node, nodes); @@ -33,8 +35,10 @@ exports.ExportDeclaration = function (node, parent, file) { declar.init = declar.init || t.identifier("undefined"); } - file.moduleFormatter.export(node, nodes, parent); + if (!file.moduleFormatter.exportDeclaration) return; + file.moduleFormatter.exportDeclaration(node, nodes, parent); } else { + if (!file.moduleFormatter.exportSpecifier) return; for (var i in node.specifiers) { file.moduleFormatter.exportSpecifier(node.specifiers[i], node, nodes, parent); }