diff options
| author | Vincent LE GOFF <g_n_s@hotmail.fr> | 2019-04-05 06:23:05 +0200 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-04-05 00:23:05 -0400 |
| commit | ae9148752ca1ec8dbbfd121dabc44c724bd8f7fd (patch) | |
| tree | d60014d61579bb60c9f05f0118f85ff1c8d12154 /strings/pad.ts | |
| parent | f8f561135016d23c0bb4ee75b6d6e54eda9daed8 (diff) | |
toml: add Stringify feature (denoland/deno_std#319)
Original: https://github.com/denoland/deno_std/commit/1e589b95532fd3575b81df65a2a99f7004f8ea1b
Diffstat (limited to 'strings/pad.ts')
| -rw-r--r-- | strings/pad.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/strings/pad.ts b/strings/pad.ts index 1c1868769..3c5084da2 100644 --- a/strings/pad.ts +++ b/strings/pad.ts @@ -3,9 +3,9 @@ /** FillOption Object */ export interface FillOption { /** Char to fill in */ - char: string; + char?: string; /** Side to fill in */ - side: "left" | "right"; + side?: "left" | "right"; /** If strict, output string can't be greater than strLen*/ strict?: boolean; /** char/string used to specify the string has been truncated */ @@ -54,7 +54,7 @@ export function pad( let out = input; const outL = out.length; if (outL < strLen) { - if (opts.side === "left") { + if (!opts.side || opts.side === "left") { out = out.padStart(strLen, opts.char); } else { out = out.padEnd(strLen, opts.char); |
