From f248207dfe5aebe6ee546286ca58dfe2c7a974df Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 23 Mar 2014 16:47:22 +0200 Subject: [PATCH] fix(util) change the way of detection node.js --- lib/util.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/util.js b/lib/util.js index f493c66d..76f5eebf 100644 --- a/lib/util.js +++ b/lib/util.js @@ -6,15 +6,12 @@ (function(scope) { 'use strict'; - var Scope; + var Scope = scope.window ? window : global; - if (scope.window) { - Scope = window; - Scope.Util = new UtilProto(); - } else { - Scope = global; - module.exports = new UtilProto(); - } + if (typeof module === 'object' && module.exports) + module.exports = new UtilProto(); + else + Scope.Util = new UtilProto(); function UtilProto() { var Util = this;