mirror of
https://github.com/tiennm99/old-free-domains.git
synced 2026-10-20 00:15:37 +00:00
Update raw-api.js
This commit is contained in:
1 parent
43c243d667
commit
821cb3fb77
1 file changed
+10
-10
+10
-10
@@ -6,10 +6,10 @@ const directoryPath = path.join(__dirname, "../domains");
|
||||
let combinedArray = [];
|
||||
|
||||
fs.readdir(directoryPath, function (err, files) {
|
||||
if(err) throw err;
|
||||
if (err) throw err;
|
||||
|
||||
function removeValue(value, index, arr) {
|
||||
if(value === "reserved") {
|
||||
if (value === "reserved") {
|
||||
arr.splice(index, 1);
|
||||
return true;
|
||||
}
|
||||
@@ -23,21 +23,21 @@ fs.readdir(directoryPath, function (err, files) {
|
||||
const filePath = path.join(directoryPath, file);
|
||||
|
||||
fs.readFile(filePath, "utf8", (err, data) => {
|
||||
if(err) throw err;
|
||||
if (err) throw err;
|
||||
|
||||
const dataArray = [JSON.parse(data)];
|
||||
|
||||
for(const item of dataArray) {
|
||||
for (const item of dataArray) {
|
||||
item.owner.email = item.owner.email.replace(/@/, " (at) ");
|
||||
}
|
||||
|
||||
combinedArray = combinedArray.concat(dataArray);
|
||||
|
||||
if(combinedArray.length === files.length) {
|
||||
if (combinedArray.length === files.length) {
|
||||
fs.writeFile("raw-api/index.json", JSON.stringify(combinedArray), (err) => {
|
||||
if(err) throw err;
|
||||
})
|
||||
if (err) throw err;
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user