diff options
Diffstat (limited to 'std/fmt')
-rw-r--r-- | std/fmt/printf.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/std/fmt/printf.ts b/std/fmt/printf.ts index 8c2f8d034..bf5feaaed 100644 --- a/std/fmt/printf.ts +++ b/std/fmt/printf.ts @@ -221,7 +221,7 @@ class Printf { flags.width += val; } // switch c break; - case State.PRECISION: + case State.PRECISION: { if (c === "*") { this.handleWidthOrPrecisionRef(WorP.PRECISION); break; @@ -236,6 +236,7 @@ class Printf { flags.precision *= 10; flags.precision += val; break; + } default: throw new Error("can't be here. bug."); } // switch state @@ -627,8 +628,7 @@ class Printf { switch (typeof val) { case "number": return this.fmtNumber(val as number, 16, upper); - break; - case "string": + case "string": { const sharp = this.flags.sharp && val.length !== 0; let hex = sharp ? "0x" : ""; const prec = this.flags.precision; @@ -647,7 +647,7 @@ class Printf { hex = hex.toUpperCase(); } return this.pad(hex); - break; + } default: throw new Error( "currently only number and string are implemented for hex" |