Skip to content

Commit

Permalink
fix AsyncIteratorPrototype option in the configurator, close #1268
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jul 6, 2023
1 parent d12cd84 commit 21cb982
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2491,6 +2491,17 @@ configurator({ USE_FUNCTION_CONSTRUCTOR: true });

require('core-js/actual/async-iterator');

(async function * () { /* empty */ })() instanceof AsyncIterator; // => true
```
- As an alternative, you could pass to the `core-js/configurator` an object that will be considered as `%AsyncIteratorPrototype%`:
```js
const configurator = require('core-js/configurator');
const { getPrototypeOf } = Object;

configurator({ AsyncIteratorPrototype: getPrototypeOf(getPrototypeOf(getPrototypeOf(async function * () { /* empty */ }()))) });

require('core-js/actual/async-iterator');

(async function * () { /* empty */ })() instanceof AsyncIterator; // => true
```
##### [`Iterator.range`](https://github.com/tc39/proposal-Number.range)[⬆](#index)
Expand Down
2 changes: 1 addition & 1 deletion packages/core-js/configurator.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = function (options) {
shared[USE_FUNCTION_CONSTRUCTOR] = !!options[USE_FUNCTION_CONSTRUCTOR];
}
if (hasOwn(options, ASYNC_ITERATOR_PROTOTYPE)) {
shared[USE_FUNCTION_CONSTRUCTOR] = options[ASYNC_ITERATOR_PROTOTYPE];
shared[ASYNC_ITERATOR_PROTOTYPE] = options[ASYNC_ITERATOR_PROTOTYPE];
}
}
};

0 comments on commit 21cb982

Please sign in to comment.