diff options
author | Elizabeth Hunt <lizhunt@amazon.com> | 2025-05-13 18:58:45 -0700 |
---|---|---|
committer | Elizabeth Hunt <lizhunt@amazon.com> | 2025-05-13 18:58:54 -0700 |
commit | 1d66a0f58e4ebcdf4f42c9d78f82a1ab49a2cf11 (patch) | |
tree | 07073c060b61688e4635fd4658315cc683589d3d /u/leftpadesque/prepend.ts | |
parent | 2543ac8b11af11f034836591046cdb52911f9403 (diff) | |
download | ci-1d66a0f58e4ebcdf4f42c9d78f82a1ab49a2cf11.tar.gz ci-1d66a0f58e4ebcdf4f42c9d78f82a1ab49a2cf11.zip |
snapshot!
Diffstat (limited to 'u/leftpadesque/prepend.ts')
-rw-r--r-- | u/leftpadesque/prepend.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/u/leftpadesque/prepend.ts b/u/leftpadesque/prepend.ts new file mode 100644 index 0000000..9b77aff --- /dev/null +++ b/u/leftpadesque/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]); |