diff options
author | Ondřej Španěl <OndrejSpanel@users.noreply.github.com> | 2017-02-24 01:51:24 +0100 |
---|---|---|
committer | Alex Lam S.L <alexlamsl@gmail.com> | 2017-02-24 08:51:24 +0800 |
commit | 852f78491a212ba20841847436dab93abb0a8181 (patch) | |
tree | 3596deb64069e4569b52580c5ed5a15cfe7a8f2c /lib/ast.js | |
parent | 229e42cdee14c384b7a48bd0882bb27d98db040a (diff) | |
download | tracifyjs-852f78491a212ba20841847436dab93abb0a8181.tar.gz tracifyjs-852f78491a212ba20841847436dab93abb0a8181.zip |
Avoid using exports when undefined (#1471)
Makes direct usage within web browser easier, even if officially unsupported.
Diffstat (limited to 'lib/ast.js')
-rw-r--r-- | lib/ast.js | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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; }; |