Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Commit

Permalink
AMD/CommonJs check swap for AMD+CommonJS mixed environments
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidg3 committed Jan 23, 2015
1 parent 14c42d2 commit 7cc55a5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions uuid.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,14 @@
uuid.unparse = unparse;
uuid.BufferClass = BufferClass;

if (typeof define === 'function' && define.amd) {
// Publish as AMD module
define(function() {return uuid;});
} else if (typeof(module) != 'undefined' && module.exports) {
if (typeof(module) != 'undefined' && module.exports) {
// Publish as node.js module
module.exports = uuid;
} else if (typeof define === 'function' && define.amd) {
// Publish as AMD module
define(function() {return uuid;});


} else {
// Publish as global (in browsers)
var _previousRoot = _global.uuid;
Expand Down

0 comments on commit 7cc55a5

Please sign in to comment.