-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.js
37 lines (31 loc) · 757 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
//
// A collection of useful resources
//
var resources = exports;
var resource = require('resource'),
fs = require('fs'),
path = require('path');
//
// Read "/resources/" directory
//
var resourcesPath = __dirname + '/';
var _resources = fs.readdirSync(resourcesPath);
//
// Filter out any potential non-resource files / folders
//
_resources = _resources.filter(function (val) {
var isResource = false;
val = resourcesPath + val;
isResource = resource.isResource(val);
return isResource;
});
//
// Export `resources` on the module scope to store all currently loaded resources
//
exports.resources = {};
//
// For every resource, use it and export it
//
_resources.forEach(function (r) {
exports.resources[r] = resource.use(r);
});