2 var getPrototypeOf = require('../internals/object-get-prototype-of');
3 var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
4 var has = require('../internals/has');
5 var wellKnownSymbol = require('../internals/well-known-symbol');
6 var IS_PURE = require('../internals/is-pure');
8 var ITERATOR = wellKnownSymbol('iterator');
9 var BUGGY_SAFARI_ITERATORS = false;
11 var returnThis = function () { return this; };
13 // `%IteratorPrototype%` object
14 // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
15 var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
18 arrayIterator = [].keys();
19 // Safari 8 has buggy iterators w/o `next`
20 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
22 PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
23 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
27 if (IteratorPrototype == undefined) IteratorPrototype = {};
29 // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
30 if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) {
31 createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
35 IteratorPrototype: IteratorPrototype,
36 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS