From 9e5e9d44ec8338b8ba8026d5e95803ec3fe7eaf7 Mon Sep 17 00:00:00 2001 From: tsctx <91457664+tsctx@users.noreply.github.com> Date: Wed, 6 Dec 2023 19:36:24 +0900 Subject: [PATCH] refactor: version cleanup --- lib/core/util.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/lib/core/util.js b/lib/core/util.js index 5a28529b663..f7855c7256c 100644 --- a/lib/core/util.js +++ b/lib/core/util.js @@ -334,19 +334,11 @@ function isDisturbed (body) { } function isErrored (body) { - return !!(body && ( - stream.isErrored - ? stream.isErrored(body) - : /state: 'errored'/.test(nodeUtil.inspect(body) - ))) + return !!(body && stream.isErrored(body)) } function isReadable (body) { - return !!(body && ( - stream.isReadable - ? stream.isReadable(body) - : /state: 'readable'/.test(nodeUtil.inspect(body) - ))) + return !!(body && stream.isReadable(body)) } function getSocketInfo (socket) { @@ -417,10 +409,7 @@ function throwIfAborted (signal) { signal.throwIfAborted() } else { if (signal.aborted) { - // DOMException not available < v17.0.0 - const err = new Error('The operation was aborted') - err.name = 'AbortError' - throw err + throw new DOMException('The operation was aborted', 'AbortError') } } }