Skip to content

Instantly share code, notes, and snippets.

@aliahmadcse
Created January 11, 2022 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aliahmadcse/e85ea789cb740a574d412921735909cb to your computer and use it in GitHub Desktop.
Save aliahmadcse/e85ea789cb740a574d412921735909cb to your computer and use it in GitHub Desktop.
Backup
const fs = require("fs");
let data = fs.readFileSync("./quicksearch.json");
data = data.toString().trim().split("\n").map(JSON.parse);
const usernames = new Set();
for (let row of data) {
if (row.headers) {
usernames.add(row.headers.username);
}
}
console.log(usernames);
// TODO: need a database call to fetch emails against these usernames
//TODO: need to map users email to username param
// TODO: need decision on updating username in message field (require string manipulation -> error prone)
const output = data.map(JSON.stringify).join("\n");
fs.writeFileSync("output-quicksearch.json", output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment