Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.

Commit bf3e01a

Browse files
committed
fix: only importing the libraries we need out of stream and util
1 parent 25485eb commit bf3e01a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-restricted-syntax */
2-
import nodeStream from 'node:stream';
3-
import nodeUtil from 'node:util';
2+
import { isErrored as streamIsErrored } from 'node:stream';
3+
import { inspect } from 'node:util';
44

55
/**
66
* @see {@link https://stackoverflow.com/a/63361543/105698}
@@ -20,9 +20,7 @@ async function streamToString(data) {
2020
* @see {@link https://github.com/nodejs/undici/blob/e39a6324c4474c6614cac98b8668e3d036aa6b18/lib/core/util.js#L333C1-L339C2}
2121
*/
2222
function isErrored(body) {
23-
return !!(
24-
body && (nodeStream.isErrored ? nodeStream.isErrored(body) : /state: 'errored'/.test(nodeUtil.inspect(body)))
25-
);
23+
return !!(body && (streamIsErrored ? streamIsErrored(body) : /state: 'errored'/.test(inspect(body))));
2624
}
2725

2826
/**

0 commit comments

Comments
 (0)