Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abhirathore2006/c3dd989cdfc8e7ab2c029f6244dbf8e6 to your computer and use it in GitHub Desktop.
Save abhirathore2006/c3dd989cdfc8e7ab2c029f6244dbf8e6 to your computer and use it in GitHub Desktop.
check if on Node Server
(function () {
// Establish the root object, `window` in the browser, or `global` on the server.
var root = this;
// Create a reference to this
var _ = new Object();
var isNode = false;
// 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' && module.exports) {
module.exports = _;
root.​_ = _​;
isNode = true;
} else {
root.​_ = _​;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment