From 86eedd2a7b2d02c282ce130c508b0c4f4e494789 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Tue, 18 Oct 2011 16:51:45 -0400 Subject: [PATCH] Fixes #335, exporting for Titanium. --- underscore.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/underscore.js b/underscore.js index 84c966ce3..1cb07d815 100644 --- a/underscore.js +++ b/underscore.js @@ -48,13 +48,13 @@ // Create a safe reference to the Underscore object for use below. var _ = function(obj) { return new wrapper(obj); }; - // Export the Underscore object for **CommonJS**, with backwards-compatibility - // for the old `require()` API. If we're not in CommonJS, add `_` to the - // global object. - if (typeof module !== 'undefined' && module.exports) { - module.exports = _; - _._ = _; - } else if (typeof exports !== 'undefined' && exports) { + // Export the Underscore object for **Node.js** and **"CommonJS"**, with + // backwards-compatibility for the old `require()` API. If we're not in + // CommonJS, add `_` to the global object. + if (typeof exports !== 'undefined') { + if (typeof module !== 'undefined' && module.exports) { + exports = module.exports = _; + } exports._ = _; } else { // Exported as a string, for Closure Compiler "advanced" mode.