summaryrefslogtreecommitdiff
path: root/strings/pad.ts
diff options
context:
space:
mode:
Diffstat (limited to 'strings/pad.ts')
-rw-r--r--strings/pad.ts6
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);