From ae9148752ca1ec8dbbfd121dabc44c724bd8f7fd Mon Sep 17 00:00:00 2001 From: Vincent LE GOFF Date: Fri, 5 Apr 2019 06:23:05 +0200 Subject: toml: add Stringify feature (denoland/deno_std#319) Original: https://github.com/denoland/deno_std/commit/1e589b95532fd3575b81df65a2a99f7004f8ea1b --- strings/pad.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'strings') 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); -- cgit v1.2.3