From ea9d093f0dad37b34c0c8707874e8f41ee84128c Mon Sep 17 00:00:00 2001 From: John Tantalo Date: Tue, 27 Nov 2012 19:50:35 -0800 Subject: [PATCH] in strict mode, `this` is undefined --- ua-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ua-parser.js b/ua-parser.js index 8347679..153344c 100644 --- a/ua-parser.js +++ b/ua-parser.js @@ -358,7 +358,7 @@ }; // check whether script is running inside node.js export as module - if (typeof exports !== 'undefined' && this.toString() !== '[object DOMWindow]') { + if (typeof exports !== 'undefined' && (!this || this.toString() !== '[object DOMWindow]')) { if (typeof module !== 'undefined' && module.exports) { exports = module.exports = UAParser; }