From c0c0dab25a76c3909d518a7a8e180b53a3903442 Mon Sep 17 00:00:00 2001 From: Aelita4 Date: Mon, 25 Dec 2023 16:18:59 +0100 Subject: [PATCH] Add helper format function --- src/lib/utils/format.ts | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/lib/utils/format.ts diff --git a/src/lib/utils/format.ts b/src/lib/utils/format.ts new file mode 100644 index 0000000..134f598 --- /dev/null +++ b/src/lib/utils/format.ts @@ -0,0 +1,3 @@ +export default function format(template: string, ...args: string[]) { + return args.reduce((p,c) => p.replace(/{}/,c), template); +} \ No newline at end of file