From 7748670fa3fddb5009c868109d619656c89cfb90 Mon Sep 17 00:00:00 2001 From: Borjan Tchakaloff Date: Tue, 8 Oct 2013 12:39:15 +0200 Subject: [PATCH] Applied the https://github.com/jashkenas/underscore/pull/431 pull request to release 1.5.2 --- underscore.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/underscore.js b/underscore.js index a2a0d5703..2d1af01ec 100644 --- a/underscore.js +++ b/underscore.js @@ -51,16 +51,22 @@ this._wrapped = obj; }; - // Export the Underscore object for **Node.js**, with - // backwards-compatibility for the old `require()` API. If we're in - // the browser, add `_` as a global object via a string identifier, - // for Closure Compiler "advanced" mode. + // 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 via a string identifier for + // the Closure Compiler "advanced" mode, and optionally register as an + // AMD module via define(). if (typeof exports !== 'undefined') { if (typeof module !== 'undefined' && module.exports) { exports = module.exports = _; } exports._ = _; } else { + if (typeof define === 'function' && define.amd) { + define('underscore', function() { + return _; + }); + } root._ = _; }