Skip to content

Commit

Permalink
fix(umd): properly detect CommonJS
Browse files Browse the repository at this point in the history
Check the module object itself for accessing module.exports (#319)
updating UMD wrapper to https://github.com/umdjs/umd/blob/master/templates/returnExports.js#L21
closes #318
  • Loading branch information
mttwc authored and rodneyrehm committed Nov 17, 2016
1 parent 59951f4 commit e5e985b
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/IPv6.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
if (typeof module === 'object' && module.exports) {
// Node
module.exports = factory();
} else if (typeof define === 'function' && define.amd) {
Expand Down
2 changes: 1 addition & 1 deletion src/SecondLevelDomains.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
if (typeof module === 'object' && module.exports) {
// Node
module.exports = factory();
} else if (typeof define === 'function' && define.amd) {
Expand Down
2 changes: 1 addition & 1 deletion src/URI.fragmentQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
if (typeof module === 'object' && module.exports) {
// Node
module.exports = factory(require('./URI'));
} else if (typeof define === 'function' && define.amd) {
Expand Down
2 changes: 1 addition & 1 deletion src/URI.fragmentURI.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
if (typeof module === 'object' && module.exports) {
// Node
module.exports = factory(require('./URI'));
} else if (typeof define === 'function' && define.amd) {
Expand Down
2 changes: 1 addition & 1 deletion src/URI.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
if (typeof module === 'object' && module.exports) {
// Node
module.exports = factory(require('./punycode'), require('./IPv6'), require('./SecondLevelDomains'));
} else if (typeof define === 'function' && define.amd) {
Expand Down
2 changes: 1 addition & 1 deletion src/URITemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
if (typeof module === 'object' && module.exports) {
// Node
module.exports = factory(require('./URI'));
} else if (typeof define === 'function' && define.amd) {
Expand Down
2 changes: 1 addition & 1 deletion src/jquery.URI.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(function (root, factory) {
'use strict';
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports === 'object') {
if (typeof module === 'object' && module.exports) {
// Node
module.exports = factory(require('jquery'), require('./URI'));
} else if (typeof define === 'function' && define.amd) {
Expand Down

0 comments on commit e5e985b

Please sign in to comment.