-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: nodejs/node#43554 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> (cherry picked from commit 389b7e138e89a339fabe4ad628bf09cd9748f957)
- Loading branch information
Showing
17 changed files
with
724 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
AbortController, | ||
AbortSignal | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const { | ||
ArrayPrototypePush | ||
} = require('#internal/per_context/primordials') | ||
const { validateAbortSignal } = require('#internal/validators') | ||
const { AbortError } = require('#internal/errors') | ||
|
||
async function toArray (options) { | ||
if (options?.signal != null) { | ||
validateAbortSignal(options.signal, 'options.signal') | ||
} | ||
|
||
const result = [] | ||
for await (const val of this) { | ||
if (options?.signal?.aborted) { | ||
throw new AbortError(undefined, { cause: options.signal.reason }) | ||
} | ||
ArrayPrototypePush(result, val) | ||
} | ||
return result | ||
} | ||
|
||
module.exports.promiseReturningOperators = { | ||
toArray | ||
} |
Oops, something went wrong.