Skip to content

Commit

Permalink
Update polyfill comments to reflect secret support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pimm committed Sep 10, 2024
1 parent 145dc4d commit cb2b0a2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/communication/NetworkClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/communication/breakUrl.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/communication/buildUrl.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
3 changes: 2 additions & 1 deletion src/plumbing/buildFromEntries.ts
Original file line number Diff line number Diff line change
@@ -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 ((): (<T>(input: Iterable<readonly [string, T]>) => Record<string, T>) => {
if (Object.fromEntries != undefined) {
Expand Down
3 changes: 0 additions & 3 deletions src/plumbing/iteration/HelpfulIterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ export default class HelpfulIterator<T> implements AsyncIterator<T, void, never>
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;
}
Expand Down

0 comments on commit cb2b0a2

Please sign in to comment.