From 852f78491a212ba20841847436dab93abb0a8181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C5=A0pan=C4=9Bl?= Date: Fri, 24 Feb 2017 01:51:24 +0100 Subject: [PATCH] Avoid using exports when undefined (#1471) Makes direct usage within web browser easier, even if officially unsupported. --- lib/ast.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ast.js b/lib/ast.js index 42506cb299..61643aedf4 100644 --- a/lib/ast.js +++ b/lib/ast.js @@ -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; };