Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Test exports if not an Element using pattern similar to lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Scott committed Jan 30, 2015
1 parent 7bd3f60 commit a81dcaa
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/observe.js
Original file line number Diff line number Diff line change
Expand Up @@ -1679,19 +1679,18 @@
return splices;
}

// Export the observe-js object for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in
// the browser, export as a global object.
// Export the observe-js object for **Node.js**, with backwards-compatibility
// for the old `require()` API. Also ensure `exports` is not a DOM Element.
// If we're in the browser, export as a global object.

var expose = global;

if (typeof exports !== 'undefined' && exports + '' === '[object Object]' &&
Object.keys(exports).length === 0) {
if (typeof exports !== 'undefined' && !exports.nodeType) {
if (typeof module !== 'undefined' && module.exports) {
expose = exports = module.exports;
exports = module.exports;
}
expose = exports;
}
}

expose.Observer = Observer;
expose.Observer.runEOM_ = runEOM;
Expand Down

0 comments on commit a81dcaa

Please sign in to comment.