mirror of
https://github.com/cwinfo/hyperboria-peers.git
synced 2024-11-09 16:40:27 +00:00
alias __dirname, use 'read'
This commit is contained in:
parent
dc3b822252
commit
65825d7fbc
5
index.js
5
index.js
@ -1,5 +1,6 @@
|
||||
var Fs = require("fs"),
|
||||
Path = require("path"),
|
||||
DIRNAME = __dirname,
|
||||
read = function (p) {
|
||||
var content = Fs.readFileSync(p, 'utf-8');
|
||||
if (content.charAt(content.length - 1) !== '\n') {
|
||||
@ -40,12 +41,12 @@ var Fs = require("fs"),
|
||||
find(peers, A.slice(1))[name] = {};
|
||||
walk(A.concat(name));
|
||||
} else if (/\.k$/.test(name)) {
|
||||
find(peers, A.slice(1))[name] = JSON.parse(Fs.readFileSync(fullPath, 'utf-8'));
|
||||
find(peers, A.slice(1))[name] = read(fullPath);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
walk([__dirname]);
|
||||
walk([DIRNAME]);
|
||||
return peers;
|
||||
}()),
|
||||
map = module.exports.map = function (f) {
|
||||
|
Loading…
Reference in New Issue
Block a user