@whatwg-node/node-fetch 0.4.16 → 0.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/utils.js +8 -5
- package/esm/utils.js +8 -5
- package/package.json +1 -1
package/cjs/utils.js
CHANGED
@@ -36,12 +36,15 @@ function fakePromise(value) {
|
|
36
36
|
// Write a fake promise to avoid the promise constructor
|
37
37
|
// being called with `new Promise` in the browser.
|
38
38
|
return {
|
39
|
-
then
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
then(resolve) {
|
40
|
+
if (resolve) {
|
41
|
+
const callbackResult = resolve(value);
|
42
|
+
if (isPromise(callbackResult)) {
|
43
|
+
return callbackResult;
|
44
|
+
}
|
45
|
+
return fakePromise(callbackResult);
|
43
46
|
}
|
44
|
-
return
|
47
|
+
return this;
|
45
48
|
},
|
46
49
|
catch() {
|
47
50
|
return this;
|
package/esm/utils.js
CHANGED
@@ -31,12 +31,15 @@ export function fakePromise(value) {
|
|
31
31
|
// Write a fake promise to avoid the promise constructor
|
32
32
|
// being called with `new Promise` in the browser.
|
33
33
|
return {
|
34
|
-
then
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
then(resolve) {
|
35
|
+
if (resolve) {
|
36
|
+
const callbackResult = resolve(value);
|
37
|
+
if (isPromise(callbackResult)) {
|
38
|
+
return callbackResult;
|
39
|
+
}
|
40
|
+
return fakePromise(callbackResult);
|
38
41
|
}
|
39
|
-
return
|
42
|
+
return this;
|
40
43
|
},
|
41
44
|
catch() {
|
42
45
|
return this;
|