From 821cb3fb77809dfc4066e7921055024b35da3733 Mon Sep 17 00:00:00 2001 From: William Harrison Date: Sat, 11 Mar 2023 18:15:12 +0800 Subject: [PATCH] Update raw-api.js --- scripts/raw-api.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/raw-api.js b/scripts/raw-api.js index 1731d9a..ec910b4 100644 --- a/scripts/raw-api.js +++ b/scripts/raw-api.js @@ -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; + }); } - }) - }) -}) + }); + }); +});