diff --git a/lib/6to5/transformation/transformer.js b/lib/6to5/transformation/transformer.js index 7239e5e976..d9587a38c0 100644 --- a/lib/6to5/transformation/transformer.js +++ b/lib/6to5/transformation/transformer.js @@ -8,20 +8,25 @@ function Transformer(key, transformer, opts) { this.manipulateOptions = transformer.manipulateOptions; this.experimental = !!transformer.experimental; this.secondPass = !!transformer.secondPass; - this.transformer = Transformer.normalise(transformer); + this.transformer = this.normalise(transformer); this.optional = !!transformer.optional; this.opts = opts || {}; this.key = key; } -Transformer.normalise = function (transformer) { +Transformer.prototype.normalise = function (transformer) { + var self = this; + if (_.isFunction(transformer)) { transformer = { ast: transformer }; } _.each(transformer, function (fns, type) { // hidden property - if (type[0] === "_") return; + if (type[0] === "_") { + self[type] = fns; + return; + } if (_.isFunction(fns)) fns = { enter: fns };