mirror of
https://github.com/cwinfo/hyperboria-peers.git
synced 2024-11-22 08:20: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"),
|
var Fs = require("fs"),
|
||||||
Path = require("path"),
|
Path = require("path"),
|
||||||
|
DIRNAME = __dirname,
|
||||||
read = function (p) {
|
read = function (p) {
|
||||||
var content = Fs.readFileSync(p, 'utf-8');
|
var content = Fs.readFileSync(p, 'utf-8');
|
||||||
if (content.charAt(content.length - 1) !== '\n') {
|
if (content.charAt(content.length - 1) !== '\n') {
|
||||||
@ -40,12 +41,12 @@ var Fs = require("fs"),
|
|||||||
find(peers, A.slice(1))[name] = {};
|
find(peers, A.slice(1))[name] = {};
|
||||||
walk(A.concat(name));
|
walk(A.concat(name));
|
||||||
} else if (/\.k$/.test(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;
|
return peers;
|
||||||
}()),
|
}()),
|
||||||
map = module.exports.map = function (f) {
|
map = module.exports.map = function (f) {
|
||||||
|
Loading…
Reference in New Issue
Block a user