From cb2b0a29dda80e4f6d544ef8494940d2dbb11e24 Mon Sep 17 00:00:00 2001 From: "Pimm \"de Chinchilla\" Hogeling" Date: Tue, 10 Sep 2024 15:27:06 +0200 Subject: [PATCH] Update polyfill comments to reflect secret support. --- src/communication/NetworkClient.ts | 3 ++- src/communication/breakUrl.ts | 2 +- src/communication/buildUrl.ts | 2 +- src/plumbing/buildFromEntries.ts | 3 ++- src/plumbing/iteration/HelpfulIterator.ts | 3 --- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/communication/NetworkClient.ts b/src/communication/NetworkClient.ts index 16af661a..a88165c2 100644 --- a/src/communication/NetworkClient.ts +++ b/src/communication/NetworkClient.ts @@ -16,7 +16,8 @@ import breakUrl from './breakUrl'; import buildUrl, { type SearchParameters } from './buildUrl'; import dromedaryCase from './dromedaryCase'; import { idempotencyHeaderName, ResponseWithIdempotencyKey, retryingFetch } from './makeRetrying'; -import { URL } from 'url'; // This isn't necessary for newer node versions, but it allows us to secretly support node 8. Should we ever drop that completely and move to 10+, we can remove this import. +// The following line is only necessary for Node.js < 10.0.0, which we only secretly support. Should we ever drop that support completely, we can remove this import. +import { URL } from 'url'; /** * Like `[].map` but with support for non-array inputs, in which case this function behaves as if an array was passed diff --git a/src/communication/breakUrl.ts b/src/communication/breakUrl.ts index f559acea..c5d1870b 100644 --- a/src/communication/breakUrl.ts +++ b/src/communication/breakUrl.ts @@ -1,4 +1,4 @@ -// If support for Node.js < 10.0.0 is ever dropped, this import can be removed. +// The following line is only necessary for Node.js < 10.0.0, which we only secretly support. Should we ever drop that support completely, we can remove this import. import { URL } from 'url'; import buildFromEntries from '../plumbing/buildFromEntries'; diff --git a/src/communication/buildUrl.ts b/src/communication/buildUrl.ts index 2191ee58..3cb79354 100644 --- a/src/communication/buildUrl.ts +++ b/src/communication/buildUrl.ts @@ -1,4 +1,4 @@ -// If support for Node.js < 10.0.0 is ever dropped, this import can be removed. +// The following line is only necessary for Node.js < 10.0.0, which we only secretly support. Should we ever drop that support completely, we can remove this import. import { URLSearchParams } from 'url'; import { apply, runIf } from 'ruply'; diff --git a/src/plumbing/buildFromEntries.ts b/src/plumbing/buildFromEntries.ts index 85e78b0c..414187ec 100644 --- a/src/plumbing/buildFromEntries.ts +++ b/src/plumbing/buildFromEntries.ts @@ -1,7 +1,8 @@ /** * Returns an object generated from the passed a list of key-value pairs. * - * If support for Node.js < 12.0.0 is ever dropped, this function can be removed in favour of `Object.fromEntries`. + * This function only exists to support Node.js < 12.0.0, which we only secretly support. Should we ever drop that + * support completely, this function can be removed in favour of `Object.fromEntries`. */ export default ((): ((input: Iterable) => Record) => { if (Object.fromEntries != undefined) { diff --git a/src/plumbing/iteration/HelpfulIterator.ts b/src/plumbing/iteration/HelpfulIterator.ts index b5afc269..73d8bdce 100644 --- a/src/plumbing/iteration/HelpfulIterator.ts +++ b/src/plumbing/iteration/HelpfulIterator.ts @@ -66,9 +66,6 @@ export default class HelpfulIterator implements AsyncIterator this.next = wrappee.next.bind(wrappee); } - // Node.js < 10.0.0 does not support Symbol.asyncIterator. Symbol.asyncIterator therefore resolves to undefined, - // which actually creates a method called "undefined" callable as iterator.undefined(). Albeit odd, I don't feel this - // warrants a "fix", especially as it only affects old Node.js versions. [Symbol.asyncIterator]() { return this; }