From ed3ba73acfa06ffbcdbd5d43b712c18765a08059 Mon Sep 17 00:00:00 2001 From: daszgfz Date: Wed, 27 Nov 2019 00:48:36 -0500 Subject: [PATCH] use padStart --- src/compiler/utils/get_code_frame.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/compiler/utils/get_code_frame.ts b/src/compiler/utils/get_code_frame.ts index d3a9426551..1097f5b3d2 100644 --- a/src/compiler/utils/get_code_frame.ts +++ b/src/compiler/utils/get_code_frame.ts @@ -18,9 +18,7 @@ export default function get_code_frame( .slice(frame_start, frame_end) .map((str, i) => { const isErrorLine = frame_start + i === line; - - let line_num = String(i + frame_start + 1); - while (line_num.length < digits) line_num = ` ${line_num}`; + const line_num = String(i + frame_start + 1).padStart(digits, ' '); if (isErrorLine) { const indicator = ' '.repeat(digits + 2 + tabs_to_spaces(str.slice(0, column)).length) + '^';