Safer CommonJS detection... module.exports must be defined.

This commit is contained in:
Jeremy Ashkenas
2010-12-01 09:44:11 -05:00
parent 2badecf038
commit c86a2fe3a8

View File

@@ -50,7 +50,7 @@
// 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') {
if (typeof module !== 'undefined' && module.exports) {
module.exports = _;
_._ = _;
} else {