diff --git a/lib/6to5/file.js b/lib/6to5/file.js index bd24298afe..3f3e813b5a 100644 --- a/lib/6to5/file.js +++ b/lib/6to5/file.js @@ -105,9 +105,9 @@ File.prototype.runTransformer = function (name, transformer) { if (!fns) return; - var fn = fns.enter || fns; + var fn = fns.enter; if (exit) fn = fns.exit; - if (!fn || !_.isFunction(fn)) return; + if (!fn) return; return fn(node, parent, self); }; diff --git a/lib/6to5/transform.js b/lib/6to5/transform.js index 2d5bfc4d60..0ebb89f1f3 100644 --- a/lib/6to5/transform.js +++ b/lib/6to5/transform.js @@ -86,3 +86,10 @@ transform.transformers = { _aliasFunctions: require("./transformers/_alias-functions") }; + +_.each(transform.transformers, function (transformer) { + _.each(transformer, function (fns, type) { + if (_.isFunction(fns)) fns = { enter: fns }; + transformer[type] = fns; + }); +});