summaryrefslogtreecommitdiff
path: root/utils/prepend.ts
diff options
context:
space:
mode:
Diffstat (limited to 'utils/prepend.ts')
-rw-r--r--utils/prepend.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/utils/prepend.ts b/utils/prepend.ts
new file mode 100644
index 0000000..9b77aff
--- /dev/null
+++ b/utils/prepend.ts
@@ -0,0 +1,4 @@
+export const prependWith = (arr: string[], prep: string) =>
+ Array(arr.length * 2).fill(0)
+ .map((_, i) => i % 2 === 0)
+ .map((isPrep, i) => isPrep ? prep : arr[i]);