Skip to content

Instantly share code, notes, and snippets.

@peterbe
Created April 22, 2021 19:06
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 peterbe/3195822bd4f0f85f5ed4f104f96fbf2b to your computer and use it in GitHub Desktop.
Save peterbe/3195822bd4f0f85f5ed4f104f96fbf2b to your computer and use it in GitHub Desktop.
const fs = require("fs");
const all = JSON.parse(fs.readFileSync("files/en-us/_wikihistory.json"));
const sorted = Object.fromEntries(
Object.keys(all)
.sort()
.map((key) => {
return [key, all[key]];
})
);
fs.writeFileSync(
"/tmp/_wikihistory.json",
JSON.stringify(sorted, null, 2) + "\n",
"utf-8"
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment