@whatwg-node/node-fetch
Advanced tools
Comparing version 0.5.18-alpha-20240726144438-d85e825aca3e8ac57c7758d5ec88ed5c27358fcc to 0.5.18-alpha-20240726152542-5f316782934ecd79aef9ea23affd78bb05e47164
@@ -16,16 +16,27 @@ "use strict"; | ||
const originalReadableFromWeb = stream_1.Readable.fromWeb; | ||
if (originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') { | ||
stream_1.Readable.fromWeb = function ReadableFromWebPatchedByWhatWgNode(stream) { | ||
if (stream.readable != null) { | ||
return stream.readable; | ||
// eslint-disable-next-line no-inner-declarations | ||
function ReadableFromWebPatchedByWhatWgNode(stream) { | ||
if (stream.readable instanceof stream_1.Readable) { | ||
return stream.readable; | ||
} | ||
return originalReadableFromWeb(stream); | ||
} | ||
if (typeof jest === 'object' && | ||
typeof afterEach === 'function' && | ||
originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') { | ||
// To relax jest, we should remove the patch after each test | ||
beforeEach(() => { | ||
if (stream_1.Readable.fromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') { | ||
stream_1.Readable.fromWeb = ReadableFromWebPatchedByWhatWgNode; | ||
} | ||
return originalReadableFromWeb(stream); | ||
}; | ||
if (typeof jest === 'object' && typeof afterEach === 'function') { | ||
// To relax jest, we should remove the patch after each test | ||
afterEach(() => { | ||
}); | ||
afterEach(() => { | ||
if (stream_1.Readable.fromWeb.name === 'ReadableFromWebPatchedByWhatWgNode') { | ||
stream_1.Readable.fromWeb = originalReadableFromWeb; | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
else if (originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') { | ||
stream_1.Readable.fromWeb = ReadableFromWebPatchedByWhatWgNode; | ||
} | ||
} | ||
@@ -32,0 +43,0 @@ catch (e) { |
@@ -8,16 +8,27 @@ import { Readable } from 'stream'; | ||
const originalReadableFromWeb = Readable.fromWeb; | ||
if (originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') { | ||
Readable.fromWeb = function ReadableFromWebPatchedByWhatWgNode(stream) { | ||
if (stream.readable != null) { | ||
return stream.readable; | ||
// eslint-disable-next-line no-inner-declarations | ||
function ReadableFromWebPatchedByWhatWgNode(stream) { | ||
if (stream.readable instanceof Readable) { | ||
return stream.readable; | ||
} | ||
return originalReadableFromWeb(stream); | ||
} | ||
if (typeof jest === 'object' && | ||
typeof afterEach === 'function' && | ||
originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') { | ||
// To relax jest, we should remove the patch after each test | ||
beforeEach(() => { | ||
if (Readable.fromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') { | ||
Readable.fromWeb = ReadableFromWebPatchedByWhatWgNode; | ||
} | ||
return originalReadableFromWeb(stream); | ||
}; | ||
if (typeof jest === 'object' && typeof afterEach === 'function') { | ||
// To relax jest, we should remove the patch after each test | ||
afterEach(() => { | ||
}); | ||
afterEach(() => { | ||
if (Readable.fromWeb.name === 'ReadableFromWebPatchedByWhatWgNode') { | ||
Readable.fromWeb = originalReadableFromWeb; | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
else if (originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') { | ||
Readable.fromWeb = ReadableFromWebPatchedByWhatWgNode; | ||
} | ||
} | ||
@@ -24,0 +35,0 @@ catch (e) { |
{ | ||
"name": "@whatwg-node/node-fetch", | ||
"version": "0.5.18-alpha-20240726144438-d85e825aca3e8ac57c7758d5ec88ed5c27358fcc", | ||
"version": "0.5.18-alpha-20240726152542-5f316782934ecd79aef9ea23affd78bb05e47164", | ||
"description": "Fetch API implementation for Node", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
201257
5131