source: trip-planner-front/node_modules/core-js/internals/check-correctness-of-iteration.js@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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