Skip to content

Commit 4424de7

Browse files
authored
style: use trimEnd() instead of regexp replace (#1070)
1 parent d931d90 commit 4424de7

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/goods.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import assert from 'node:assert'
1616
import { createInterface } from 'node:readline'
17-
import process from 'node:process'
1817
import { $, within, ProcessOutput } from './core.js'
1918
import {
2019
type Duration,
@@ -25,10 +24,10 @@ import {
2524
toCamelCase,
2625
} from './util.js'
2726
import {
28-
minimist,
29-
nodeFetch,
3027
type RequestInfo,
3128
type RequestInit,
29+
nodeFetch,
30+
minimist,
3231
} from './vendor.js'
3332

3433
export { default as path } from 'node:path'
@@ -83,9 +82,7 @@ export function echo(pieces: TemplateStringsArray, ...args: any[]) {
8382
}
8483

8584
function stringify(arg: ProcessOutput | any) {
86-
return arg instanceof ProcessOutput
87-
? arg.toString().replace(/\n$/, '')
88-
: `${arg}`
85+
return arg instanceof ProcessOutput ? arg.toString().trimEnd() : `${arg}`
8986
}
9087

9188
export async function question(

src/repl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function startRepl(history = HISTORY) {
3030
preview: false,
3131
writer(output: any) {
3232
return output instanceof ProcessOutput
33-
? output.toString().replace(/\n$/, '')
33+
? output.toString().trimEnd()
3434
: inspect(output, { colors: true })
3535
},
3636
})

0 commit comments

Comments
 (0)