-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
42 lines (41 loc) · 1022 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Classes loader
* @return {function} that is loading classes and storing thwem in a object
*
* How to use:
*
* Loading express library
* __classes("express")
*
* Loading a custom module
* __classes("myChoosedModuleName", "http://.w....../file.js");
* Using curtom module
* __classes("myChoosedModuleName");
*
* Link a nodejs module with onother name
* __classes("server-module", "express");
* Using renamed module
* __classes("server-module")
*/
var __classes = ((function () {
var __cache = {};
var __load = function (library, library_source) {
if (library === true) {
if (!library_source)
return __cache;
} else {
if (!(library in __cache)) {
if (typeof(library_source) === "function") {
__cache[library] = library_source(__load, library);
} else {
__cache[library] = require(library_source || library);
}
}
return __cache[library];
}
};
return __load;
})());
if (typeof(module) === "object" && module) {
module.exports = __classes;
}