Skip to main content
variable pad
import { pad } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Pads a string on both sides with the specified character, if it's shorter than the specified length.

Use String.prototype.padStart() and String.prototype.padEnd() to pad both sides of the given string. Omit the third argument, char, to use the whitespace character as the default padding character.

type

(
str: string | number,
length: number,
char?,
) => unknown