Files
blitzkit/src/LEGACY_core/discord/markdownTable.ts
T

9 lines
327 B
TypeScript
Raw Normal View History

2023-05-20 00:48:52 +00:00
export type TableInputEntry = [string, string | number] | [];
export type TableInput = TableInputEntry[];
2023-05-13 21:42:40 +00:00
2023-06-27 02:22:28 +00:00
export default function markdownTable(input: TableInput) {
2023-05-13 21:42:40 +00:00
return input
2023-06-02 01:31:14 +00:00
.filter((array) => array[1] !== undefined)
2023-05-13 21:42:40 +00:00
.map((array) => (array.length === 0 ? '' : `**${array[0]}**: ${array[1]}`))
.join('\n');
}