Skip to content

Commit fbed9be

Browse files
committed
add a fallback for regenerator transform
1 parent 75e66f2 commit fbed9be

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/helpers/qunit-helpers.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
import Symbol from '@core-js/pure/es/symbol';
2+
import globalThis from '@core-js/pure/es/global-this';
13
import assign from '@core-js/pure/es/object/assign';
24
import isIterable from '@core-js/pure/es/is-iterable';
3-
import ASYNC_ITERATOR from '@core-js/pure/es/symbol/async-iterator';
45
import { is, arrayFromArrayLike } from './helpers.js';
56

7+
function toPropertyKey(it) {
8+
return typeof it === 'symbol' ? it : String(it);
9+
}
10+
11+
// for Babel / Regenerator runtime
12+
if (!globalThis.Symbol || toPropertyKey(globalThis.Symbol.iterator) !== toPropertyKey(Symbol.iterator)) {
13+
globalThis.Symbol = Symbol;
14+
}
15+
616
const { getOwnPropertyDescriptor, getOwnPropertyNames } = Object;
717
const { toString, propertyIsEnumerable } = Object.prototype;
818

@@ -46,7 +56,7 @@ assign(assert, {
4656
},
4757
isAsyncIterable(actual, message = 'The value is async iterable') {
4858
this.pushResult({
49-
result: typeof actual == 'object' && typeof actual[ASYNC_ITERATOR] == 'function',
59+
result: typeof actual == 'object' && typeof actual[Symbol.asyncIterator] == 'function',
5060
actual,
5161
expected: 'The value should be async iterable',
5262
message,

0 commit comments

Comments
 (0)