Created
June 16, 2021 10:22
-
-
Save theronic/0a2383efaa36ca9bde8961bb230f8143 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn left-pad | |
"Left-pads inputs with prefix up to length n (just in case String.padStart stops working one day)." | |
[n prefix input] | |
(let [s (str input)] | |
(str (string/join "" (repeat (- n (.-length s)) prefix)) s))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment