From 8c4631baa9e93997cff94ee3d5debb5a059a8567 Mon Sep 17 00:00:00 2001 From: Wiktoria Van Harneveldt Date: Mon, 16 Dec 2024 22:22:28 +0100 Subject: [PATCH] Add utility function to convert string to 2D array --- utils/to2d.ts | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 utils/to2d.ts diff --git a/utils/to2d.ts b/utils/to2d.ts new file mode 100644 index 0000000..7ff17e7 --- /dev/null +++ b/utils/to2d.ts @@ -0,0 +1,3 @@ +export function to2D(input: string, split: string = ""): string[][] { + return input.split("\n").map((line) => line.split(split)); +}