diff2html/lib/fakeRequire.js
Rodrigo Fernandes 6514ac7477 clean project, better module exposing and documentation
* use native JS in example instead of jQuery
 * better module exposing now using exports, module.export, self, window, global and this
 * add example link to bower and npm definition
 * add documentation on how to highlight
2015-07-19 22:08:17 +01:00

20 lines
666 B
JavaScript

/*
* Hack to allow nodejs require("package/file") in the browser
* How?
* Since every require is used as an object:
* `require("./utils.js").Utils` // (notice the `.Utils`)
*
* We can say that when there is no require method
* we use the global object in which the `Utils`
* object was already injected.
*/
var $globalHolder = (typeof module !== 'undefined' && module.exports) ||
(typeof exports !== 'undefined' && exports) ||
(typeof window !== 'undefined' && window) ||
(typeof self !== 'undefined' && self) ||
(typeof this !== 'undefined' && this) ||
Function('return this')();
function require() {
return $globalHolder;
}