From bd3d3e3b0c5750422736566ba9e0f57553b85829 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Fri, 4 Feb 2022 13:02:00 +0000 Subject: [PATCH] Fix formatting --- .../scripts/rerunners/parse-wacca-csv.js | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/database-seeds/scripts/rerunners/parse-wacca-csv.js b/database-seeds/scripts/rerunners/parse-wacca-csv.js index c626805e8..87957abe2 100644 --- a/database-seeds/scripts/rerunners/parse-wacca-csv.js +++ b/database-seeds/scripts/rerunners/parse-wacca-csv.js @@ -40,7 +40,7 @@ const dataMap = new Map(); // we have to skip the first record because its the headers, // and there's literally no way to change this behaviour. for (const record of dirtyRecords.slice(1)) { - dataMap.set(record[0].replace(/”|“/g, '"').replace(/’/g, "'"), record); + dataMap.set(record[0].replace(/”|“/gu, '"').replace(/’/gu, "'"), record); } const STARTS = { @@ -51,12 +51,14 @@ const STARTS = { }; (async () => { - const existingSongs = new Map(ReadCollection("songs-wacca.json").map(e => - [e.title, e.id])); - const existingCharts = new Map(ReadCollection("charts-wacca.json").map(e => - // We need to combine songID and difficulty for the key, - // this seems like the simplest way. - [`${e.songID} ${e.difficulty}`, e.chartID])); + const existingSongs = new Map(ReadCollection("songs-wacca.json").map((e) => [e.title, e.id])); + const existingCharts = new Map( + ReadCollection("charts-wacca.json").map((e) => + // We need to combine songID and difficulty for the key, + // this seems like the simplest way. + [`${e.songID} ${e.difficulty}`, e.chartID] + ) + ); const datum = await fetch("https://wacca.marv.jp/music/search.php", { method: "POST", @@ -162,7 +164,12 @@ const STARTS = { } } - fs.writeFileSync(path.resolve(__dirname, "../../collections/charts-wacca.json"), JSON.stringify(charts, null, "\t")); - fs.writeFileSync(path.resolve(__dirname, "../../collections/songs-wacca.json"), JSON.stringify(songs, null, "\t")); - + fs.writeFileSync( + path.resolve(__dirname, "../../collections/charts-wacca.json"), + JSON.stringify(charts, null, "\t") + ); + fs.writeFileSync( + path.resolve(__dirname, "../../collections/songs-wacca.json"), + JSON.stringify(songs, null, "\t") + ); })();