0
0
mirror of https://github.com/Doodle3D/Doodle3D-API synced 2024-12-23 22:13:48 +01:00
Doodle3D-API/jspm_packages/npm/core-js@0.9.18/modules/$.iter-detect.js

30 lines
591 B
JavaScript
Raw Normal View History

2015-07-15 15:06:18 +02:00
/* */
var SYMBOL_ITERATOR = require("./$.wks")('iterator'),
SAFE_CLOSING = false;
try {
var riter = [7][SYMBOL_ITERATOR]();
riter['return'] = function() {
SAFE_CLOSING = true;
};
Array.from(riter, function() {
throw 2;
});
} catch (e) {}
module.exports = function(exec) {
if (!SAFE_CLOSING)
return false;
var safe = false;
try {
var arr = [7],
iter = arr[SYMBOL_ITERATOR]();
iter.next = function() {
safe = true;
};
arr[SYMBOL_ITERATOR] = function() {
return iter;
};
exec(arr);
} catch (e) {}
return safe;
};