SCSS Left Pad

Silly implementation of a well-known JS function in SCSS.

Usage

@debug leftpad("bar", 5, "_");
// "__bar"

@debug leftpad("foo", 4, "");
// " foo"

Used to generate Markdown-like headings:

@import "leftpad.scss";
// ...

@for $i from 1 through 5 {
    pre:nth-child(#{$i})::before {
        content: leftpad(" ", $i+1, "#");
    }
}

Why?

Cause why not?