Avoid using exports when undefined (#1471)

Makes direct usage within web browser easier, even if officially unsupported.
This commit is contained in:
Ondřej Španěl
2017-02-24 01:51:24 +01:00
committed by Alex Lam S.L
parent 229e42cdee
commit 852f78491a

View File

@@ -81,7 +81,9 @@ function DEFNODE(type, props, methods, base) {
ctor.DEFMETHOD = function(name, method) { ctor.DEFMETHOD = function(name, method) {
this.prototype[name] = method; this.prototype[name] = method;
}; };
exports["AST_" + type] = ctor; if (typeof exports !== "undefined") {
exports["AST_" + type] = ctor;
}
return ctor; return ctor;
}; };