blob: b3e276ff67be4325752fe548a045d742c823fee4 [file] [log] [blame]
pineafan1dc15722022-03-14 21:27:34 +00001const forceCaps = [
2 "ID",
3 "NSFW"
4]
5
6export function capitalize(s: string) {
7 s = s.replace(/([A-Z])/g, ' $1');
8 return forceCaps.includes(s.toUpperCase()) ? s.toUpperCase() : s[0].toUpperCase() + s.slice(1).toLowerCase();
pineafan4f164f32022-02-26 22:07:12 +00009}
10
11function keyValueList(data) {
12 let out = "";
13 Object.entries(data).map(([key, value]) => {
14 out += `**${capitalize(key)}:** ${value}\n`
15 })
16 return out;
17}
18
19export default keyValueList;