alias hidden properties onto it's transformer instance
This commit is contained in:
parent
9fd1ec0596
commit
77add8704e
@ -8,20 +8,25 @@ function Transformer(key, transformer, opts) {
|
|||||||
this.manipulateOptions = transformer.manipulateOptions;
|
this.manipulateOptions = transformer.manipulateOptions;
|
||||||
this.experimental = !!transformer.experimental;
|
this.experimental = !!transformer.experimental;
|
||||||
this.secondPass = !!transformer.secondPass;
|
this.secondPass = !!transformer.secondPass;
|
||||||
this.transformer = Transformer.normalise(transformer);
|
this.transformer = this.normalise(transformer);
|
||||||
this.optional = !!transformer.optional;
|
this.optional = !!transformer.optional;
|
||||||
this.opts = opts || {};
|
this.opts = opts || {};
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
Transformer.normalise = function (transformer) {
|
Transformer.prototype.normalise = function (transformer) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
if (_.isFunction(transformer)) {
|
if (_.isFunction(transformer)) {
|
||||||
transformer = { ast: transformer };
|
transformer = { ast: transformer };
|
||||||
}
|
}
|
||||||
|
|
||||||
_.each(transformer, function (fns, type) {
|
_.each(transformer, function (fns, type) {
|
||||||
// hidden property
|
// hidden property
|
||||||
if (type[0] === "_") return;
|
if (type[0] === "_") {
|
||||||
|
self[type] = fns;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_.isFunction(fns)) fns = { enter: fns };
|
if (_.isFunction(fns)) fns = { enter: fns };
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user