Avoid using exports when undefined (#1471)
Makes direct usage within web browser easier, even if officially unsupported.
This commit is contained in:
committed by
Alex Lam S.L
parent
229e42cdee
commit
852f78491a
@@ -81,7 +81,9 @@ function DEFNODE(type, props, methods, base) {
|
||||
ctor.DEFMETHOD = function(name, method) {
|
||||
this.prototype[name] = method;
|
||||
};
|
||||
exports["AST_" + type] = ctor;
|
||||
if (typeof exports !== "undefined") {
|
||||
exports["AST_" + type] = ctor;
|
||||
}
|
||||
return ctor;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user