massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / internals / iterators-core.js
1 'use strict';
2 var fails = require('../internals/fails');
3 var isCallable = require('../internals/is-callable');
4 var create = require('../internals/object-create');
5 var getPrototypeOf = require('../internals/object-get-prototype-of');
6 var redefine = require('../internals/redefine');
7 var wellKnownSymbol = require('../internals/well-known-symbol');
8 var IS_PURE = require('../internals/is-pure');
9
10 var ITERATOR = wellKnownSymbol('iterator');
11 var BUGGY_SAFARI_ITERATORS = false;
12
13 // `%IteratorPrototype%` object
14 // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
15 var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
16
17 /* eslint-disable es/no-array-prototype-keys -- safe */
18 if ([].keys) {
19   arrayIterator = [].keys();
20   // Safari 8 has buggy iterators w/o `next`
21   if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
22   else {
23     PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
24     if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
25   }
26 }
27
28 var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
29   var test = {};
30   // FF44- legacy iterators case
31   return IteratorPrototype[ITERATOR].call(test) !== test;
32 });
33
34 if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
35 else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
36
37 // `%IteratorPrototype%[@@iterator]()` method
38 // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
39 if (!isCallable(IteratorPrototype[ITERATOR])) {
40   redefine(IteratorPrototype, ITERATOR, function () {
41     return this;
42   });
43 }
44
45 module.exports = {
46   IteratorPrototype: IteratorPrototype,
47   BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
48 };