source: frontend/node_modules/core-js/internals/check-correctness-of-iteration.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.2 KB
Line 
1'use strict';
2var wellKnownSymbol = require('../internals/well-known-symbol');
3
4var ITERATOR = wellKnownSymbol('iterator');
5var SAFE_CLOSING = false;
6
7try {
8 var called = 0;
9 var iteratorWithReturn = {
10 next: function () {
11 return { done: !!called++ };
12 },
13 'return': function () {
14 SAFE_CLOSING = true;
15 }
16 };
17 // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
18 iteratorWithReturn[ITERATOR] = function () {
19 return this;
20 };
21 // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
22 Array.from(iteratorWithReturn, function () { throw 2; });
23} catch (error) { /* empty */ }
24
25module.exports = function (exec, SKIP_CLOSING) {
26 try {
27 if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
28 } catch (error) { return false; } // workaround of old WebKit + `eval` bug
29 var ITERATION_SUPPORT = false;
30 try {
31 var object = {};
32 // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
33 object[ITERATOR] = function () {
34 return {
35 next: function () {
36 return { done: ITERATION_SUPPORT = true };
37 }
38 };
39 };
40 exec(object);
41 } catch (error) { /* empty */ }
42 return ITERATION_SUPPORT;
43};
Note: See TracBrowser for help on using the repository browser.