Skip to content

Commit

Permalink
chore(ts): small tweaks to make typescript happier
Browse files Browse the repository at this point in the history
- Use trimStart/trimEnd instead of deprecated trimLeft/trimRight
  • Loading branch information
isaacs committed May 1, 2023
1 parent af3145d commit 3ed58ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"target": "es2017",
"moduleResolution": "node",
"module": "es2015"
},
},
"include": [
"lib/**/*.ts"
],
"exclude": [
"lib/cjs.ts"
]
}
}

0 comments on commit 3ed58ce

Please sign in to comment.