UNPKG

781 BJavaScriptView Raw
1/**
2 * Created by chadfraser on 25/02/2017.
3 */
4import path from 'path';
5module.exports = function (){
6 return new Promise(function (resolve, reject) {
7 try {
8 let locations = [spice.root_path+'/validators']
9 let config = {}
10 for(let i of locations){
11 let files = require('fs').readdirSync(i);
12 files.forEach(function (file) {
13 if (file != 'index.js') {
14 let name = file.split('.')[0];
15 require(path.join(i, file));
16 console.log('Loading Validator', path.join(i, file));
17 }
18 });
19 }
20 resolve(config)
21
22 } catch (e) {
23 reject(e);
24 }
25 });
26}
\No newline at end of file