From 3ed58ceea771ca14d81b85715ef0ff397fca4880 Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 28 Apr 2023 16:31:29 -0700 Subject: [PATCH] chore(ts): small tweaks to make typescript happier - Use trimStart/trimEnd instead of deprecated trimLeft/trimRight --- lib/index.ts | 6 +++--- tsconfig.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 0673c3a..2188e50 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -204,7 +204,7 @@ export class UI { const match = source.match(/^ */) const leadingWhitespace = match ? match[0].length : 0 const target = previousLine.text - const targetTextWidth = mixin.stringWidth(target.trimRight()) + const targetTextWidth = mixin.stringWidth(target.trimEnd()) if (!previousLine.span) { return source @@ -223,13 +223,13 @@ export class UI { previousLine.hidden = true - return target.trimRight() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimLeft() + return target.trimEnd() + ' '.repeat(leadingWhitespace - targetTextWidth) + source.trimStart() } private rasterize (row: ColumnArray) { const rrows: string[][] = [] const widths = this.columnWidths(row) - let wrapped + let wrapped: string[] // word wrap all columns, and create // a data-structure that is easy to rasterize. diff --git a/tsconfig.json b/tsconfig.json index d5d8c21..5b52b82 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,11 +7,11 @@ "target": "es2017", "moduleResolution": "node", "module": "es2015" - }, + }, "include": [ "lib/**/*.ts" ], "exclude": [ "lib/cjs.ts" ] -} \ No newline at end of file +}