Skip to content

Commit 53f0d6d

Browse files
committed
[Fix] use get-intrinsic to get the proper AsyncIteratorPrototype in modern engines
1 parent 7aaedbb commit 53f0d6d

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
'use strict';
22

33
var hasSymbols = require('has-symbols');
4+
var GetIntrinsic = require('get-intrinsic');
45

56
/* globals AsyncIterator: false */
67

7-
var asyncIterProto = typeof AsyncIterator === 'function' ? AsyncIterator.prototype : {};
8+
var asyncIterProto = typeof AsyncIterator === 'function' ? AsyncIterator.prototype : GetIntrinsic('%AsyncIteratorPrototype%', true) || {};
89

910
if (hasSymbols() && Symbol.asyncIterator && !(Symbol.asyncIterator in asyncIterProto)) {
1011
asyncIterProto[Symbol.asyncIterator] = function () {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
},
4141
"homepage": "https://github.com/ljharb/AsyncIterator.prototype#readme",
4242
"dependencies": {
43+
"get-intrinsic": "^1.2.4",
4344
"has-symbols": "^1.0.3"
4445
},
4546
"devDependencies": {

0 commit comments

Comments
 (0)