38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
/** PURE_IMPORTS_START .._util_root PURE_IMPORTS_END */
|
|
import { root } from '../util/root';
|
|
export function symbolIteratorPonyfill(root) {
|
|
var Symbol = root.Symbol;
|
|
if (typeof Symbol === 'function') {
|
|
if (!Symbol.iterator) {
|
|
Symbol.iterator = Symbol('iterator polyfill');
|
|
}
|
|
return Symbol.iterator;
|
|
}
|
|
else {
|
|
// [for Mozilla Gecko 27-35:](https://mzl.la/2ewE1zC)
|
|
var Set_1 = root.Set;
|
|
if (Set_1 && typeof new Set_1()['@@iterator'] === 'function') {
|
|
return '@@iterator';
|
|
}
|
|
var Map_1 = root.Map;
|
|
// required for compatability with es6-shim
|
|
if (Map_1) {
|
|
var keys = Object.getOwnPropertyNames(Map_1.prototype);
|
|
for (var i = 0; i < keys.length; ++i) {
|
|
var key = keys[i];
|
|
// according to spec, Map.prototype[@@iterator] and Map.orototype.entries must be equal.
|
|
if (key !== 'entries' && key !== 'size' && Map_1.prototype[key] === Map_1.prototype['entries']) {
|
|
return key;
|
|
}
|
|
}
|
|
}
|
|
return '@@iterator';
|
|
}
|
|
}
|
|
export var iterator = /*@__PURE__*/ symbolIteratorPonyfill(root);
|
|
/**
|
|
* @deprecated use iterator instead
|
|
*/
|
|
export var $$iterator = iterator;
|
|
//# sourceMappingURL=iterator.js.map
|