@whatwg-node/node-fetch 0.7.20-alpha-20250516142524-e8bdaf25fc549c26f49186be0de64831fed82de8 → 0.7.20-alpha-20250516144536-d877ab7207b10d1c763b885206f8767feb838e5a

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/Headers.js CHANGED
@@ -4,7 +4,6 @@ exports.PonyfillHeaders = void 0;
4
4
  exports.isHeadersLike = isHeadersLike;
5
5
  const node_util_1 = require("node:util");
6
6
  const IteratorObject_js_1 = require("./IteratorObject.js");
7
- const utils_js_1 = require("./utils.js");
8
7
  function isHeadersLike(headers) {
9
8
  return headers?.get && headers?.forEach;
10
9
  }
@@ -31,7 +30,7 @@ class PonyfillHeaders {
31
30
  if (this.headersInit == null) {
32
31
  return null;
33
32
  }
34
- if ((0, utils_js_1.isArray)(this.headersInit)) {
33
+ if (Array.isArray(this.headersInit)) {
35
34
  const found = this.headersInit.filter(([headerKey]) => headerKey.toLowerCase() === normalized);
36
35
  if (found.length === 0) {
37
36
  return null;
@@ -69,7 +68,7 @@ class PonyfillHeaders {
69
68
  if (!this._map) {
70
69
  this._setCookies ||= [];
71
70
  if (this.headersInit != null) {
72
- if ((0, utils_js_1.isArray)(this.headersInit)) {
71
+ if (Array.isArray(this.headersInit)) {
73
72
  this._map = new Map();
74
73
  for (const [key, value] of this.headersInit) {
75
74
  const normalizedKey = key.toLowerCase();
@@ -145,7 +144,7 @@ class PonyfillHeaders {
145
144
  return;
146
145
  }
147
146
  if (!this._map && this.headersInit != null) {
148
- if ((0, utils_js_1.isArray)(this.headersInit)) {
147
+ if (Array.isArray(this.headersInit)) {
149
148
  const found = this.headersInit.find(([headerKey]) => headerKey.toLowerCase() === key);
150
149
  if (found) {
151
150
  found[1] = value;
@@ -180,7 +179,7 @@ class PonyfillHeaders {
180
179
  });
181
180
  if (!this._map) {
182
181
  if (this.headersInit) {
183
- if ((0, utils_js_1.isArray)(this.headersInit)) {
182
+ if (Array.isArray(this.headersInit)) {
184
183
  this.headersInit.forEach(([key, value]) => {
185
184
  callback(value, key, this);
186
185
  });
@@ -208,7 +207,7 @@ class PonyfillHeaders {
208
207
  }
209
208
  if (!this._map) {
210
209
  if (this.headersInit) {
211
- if ((0, utils_js_1.isArray)(this.headersInit)) {
210
+ if (Array.isArray(this.headersInit)) {
212
211
  yield* this.headersInit.map(([key]) => key)[Symbol.iterator]();
213
212
  return;
214
213
  }
@@ -231,7 +230,7 @@ class PonyfillHeaders {
231
230
  }
232
231
  if (!this._map) {
233
232
  if (this.headersInit) {
234
- if ((0, utils_js_1.isArray)(this.headersInit)) {
233
+ if (Array.isArray(this.headersInit)) {
235
234
  yield* this.headersInit.map(([, value]) => value)[Symbol.iterator]();
236
235
  return;
237
236
  }
@@ -254,7 +253,7 @@ class PonyfillHeaders {
254
253
  }
255
254
  if (!this._map) {
256
255
  if (this.headersInit) {
257
- if ((0, utils_js_1.isArray)(this.headersInit)) {
256
+ if (Array.isArray(this.headersInit)) {
258
257
  yield* this.headersInit;
259
258
  return;
260
259
  }
package/cjs/Response.js CHANGED
@@ -4,7 +4,6 @@ exports.PonyfillResponse = void 0;
4
4
  const node_http_1 = require("node:http");
5
5
  const Body_js_1 = require("./Body.js");
6
6
  const Headers_js_1 = require("./Headers.js");
7
- const utils_js_1 = require("./utils.js");
8
7
  const JSON_CONTENT_TYPE = 'application/json; charset=utf-8';
9
8
  class PonyfillResponse extends Body_js_1.PonyfillBody {
10
9
  headers;
@@ -67,7 +66,7 @@ class PonyfillResponse extends Body_js_1.PonyfillBody {
67
66
  init.headers.set('content-type', JSON_CONTENT_TYPE);
68
67
  }
69
68
  }
70
- else if ((0, utils_js_1.isArray)(init.headers)) {
69
+ else if (Array.isArray(init.headers)) {
71
70
  if (!init.headers.some(([key]) => key.toLowerCase() === 'content-type')) {
72
71
  init.headers.push(['content-type', JSON_CONTENT_TYPE]);
73
72
  }
package/cjs/utils.js CHANGED
@@ -10,7 +10,6 @@ exports.shouldRedirect = shouldRedirect;
10
10
  exports.wrapIncomingMessageWithPassthrough = wrapIncomingMessageWithPassthrough;
11
11
  exports.endStream = endStream;
12
12
  exports.safeWrite = safeWrite;
13
- exports.isArray = isArray;
14
13
  const node_events_1 = require("node:events");
15
14
  const node_stream_1 = require("node:stream");
16
15
  const promises_1 = require("node:stream/promises");
@@ -79,6 +78,3 @@ function safeWrite(chunk, stream, signal) {
79
78
  });
80
79
  }
81
80
  }
82
- function isArray(value) {
83
- return value?.splice != null;
84
- }
package/esm/Headers.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { inspect } from 'node:util';
2
2
  import { PonyfillIteratorObject } from './IteratorObject.js';
3
- import { isArray } from './utils.js';
4
3
  export function isHeadersLike(headers) {
5
4
  return headers?.get && headers?.forEach;
6
5
  }
@@ -27,7 +26,7 @@ export class PonyfillHeaders {
27
26
  if (this.headersInit == null) {
28
27
  return null;
29
28
  }
30
- if (isArray(this.headersInit)) {
29
+ if (Array.isArray(this.headersInit)) {
31
30
  const found = this.headersInit.filter(([headerKey]) => headerKey.toLowerCase() === normalized);
32
31
  if (found.length === 0) {
33
32
  return null;
@@ -65,7 +64,7 @@ export class PonyfillHeaders {
65
64
  if (!this._map) {
66
65
  this._setCookies ||= [];
67
66
  if (this.headersInit != null) {
68
- if (isArray(this.headersInit)) {
67
+ if (Array.isArray(this.headersInit)) {
69
68
  this._map = new Map();
70
69
  for (const [key, value] of this.headersInit) {
71
70
  const normalizedKey = key.toLowerCase();
@@ -141,7 +140,7 @@ export class PonyfillHeaders {
141
140
  return;
142
141
  }
143
142
  if (!this._map && this.headersInit != null) {
144
- if (isArray(this.headersInit)) {
143
+ if (Array.isArray(this.headersInit)) {
145
144
  const found = this.headersInit.find(([headerKey]) => headerKey.toLowerCase() === key);
146
145
  if (found) {
147
146
  found[1] = value;
@@ -176,7 +175,7 @@ export class PonyfillHeaders {
176
175
  });
177
176
  if (!this._map) {
178
177
  if (this.headersInit) {
179
- if (isArray(this.headersInit)) {
178
+ if (Array.isArray(this.headersInit)) {
180
179
  this.headersInit.forEach(([key, value]) => {
181
180
  callback(value, key, this);
182
181
  });
@@ -204,7 +203,7 @@ export class PonyfillHeaders {
204
203
  }
205
204
  if (!this._map) {
206
205
  if (this.headersInit) {
207
- if (isArray(this.headersInit)) {
206
+ if (Array.isArray(this.headersInit)) {
208
207
  yield* this.headersInit.map(([key]) => key)[Symbol.iterator]();
209
208
  return;
210
209
  }
@@ -227,7 +226,7 @@ export class PonyfillHeaders {
227
226
  }
228
227
  if (!this._map) {
229
228
  if (this.headersInit) {
230
- if (isArray(this.headersInit)) {
229
+ if (Array.isArray(this.headersInit)) {
231
230
  yield* this.headersInit.map(([, value]) => value)[Symbol.iterator]();
232
231
  return;
233
232
  }
@@ -250,7 +249,7 @@ export class PonyfillHeaders {
250
249
  }
251
250
  if (!this._map) {
252
251
  if (this.headersInit) {
253
- if (isArray(this.headersInit)) {
252
+ if (Array.isArray(this.headersInit)) {
254
253
  yield* this.headersInit;
255
254
  return;
256
255
  }
package/esm/Response.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { STATUS_CODES } from 'node:http';
2
2
  import { PonyfillBody } from './Body.js';
3
3
  import { isHeadersLike, PonyfillHeaders } from './Headers.js';
4
- import { isArray } from './utils.js';
5
4
  const JSON_CONTENT_TYPE = 'application/json; charset=utf-8';
6
5
  export class PonyfillResponse extends PonyfillBody {
7
6
  headers;
@@ -64,7 +63,7 @@ export class PonyfillResponse extends PonyfillBody {
64
63
  init.headers.set('content-type', JSON_CONTENT_TYPE);
65
64
  }
66
65
  }
67
- else if (isArray(init.headers)) {
66
+ else if (Array.isArray(init.headers)) {
68
67
  if (!init.headers.some(([key]) => key.toLowerCase() === 'content-type')) {
69
68
  init.headers.push(['content-type', JSON_CONTENT_TYPE]);
70
69
  }
package/esm/utils.js CHANGED
@@ -65,6 +65,3 @@ export function safeWrite(chunk, stream, signal) {
65
65
  });
66
66
  }
67
67
  }
68
- export function isArray(value) {
69
- return value?.splice != null;
70
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.7.20-alpha-20250516142524-e8bdaf25fc549c26f49186be0de64831fed82de8",
3
+ "version": "0.7.20-alpha-20250516144536-d877ab7207b10d1c763b885206f8767feb838e5a",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {
@@ -17,4 +17,3 @@ export declare function endStream(stream: {
17
17
  end: () => void;
18
18
  }): void;
19
19
  export declare function safeWrite(chunk: any, stream: Writable, signal?: AbortSignal | undefined): Promise<any> | undefined;
20
- export declare function isArray<T>(value: any): value is T[];
@@ -17,4 +17,3 @@ export declare function endStream(stream: {
17
17
  end: () => void;
18
18
  }): void;
19
19
  export declare function safeWrite(chunk: any, stream: Writable, signal?: AbortSignal | undefined): Promise<any> | undefined;
20
- export declare function isArray<T>(value: any): value is T[];