PageRenderTime 20ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/node_modules/babel-polyfill/node_modules/core-js/library/modules/_iter-detect.js

https://bitbucket.org/worklabschd/bingle_customer2
JavaScript | 22 lines | 19 code | 2 blank | 1 comment | 2 complexity | 4de37588a3e0b7c3c5056ab01a2c8fad MD5 | raw file
 1var ITERATOR = require('./_wks')('iterator');
 2var SAFE_CLOSING = false;
 3
 4try {
 5  var riter = [7][ITERATOR]();
 6  riter['return'] = function () { SAFE_CLOSING = true; };
 7  // eslint-disable-next-line no-throw-literal
 8  Array.from(riter, function () { throw 2; });
 9} catch (e) { /* empty */ }
10
11module.exports = function (exec, skipClosing) {
12  if (!skipClosing && !SAFE_CLOSING) return false;
13  var safe = false;
14  try {
15    var arr = [7];
16    var iter = arr[ITERATOR]();
17    iter.next = function () { return { done: safe = true }; };
18    arr[ITERATOR] = function () { return iter; };
19    exec(arr);
20  } catch (e) { /* empty */ }
21  return safe;
22};