summaryrefslogtreecommitdiff
path: root/u/leftpadesque/prepend.ts
blob: d80f6b60276121b60212938a99eaed8a5815b60d (plain)
1
2
3
4
5
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]!));