blob: 9fbe84a846ee55e38326cfb8c6d1edac0791a7f6 [file] [log] [blame]
var global = this;
function __createIterableObject(arr, methods) {
methods = methods || {};
if (typeof Symbol !== 'function' || !Symbol.iterator) {
return {};
}
arr.length++;
var iterator = {
next: function() {
return { value: arr.shift(), done: arr.length <= 0 };
},
'return': methods['return'],
'throw': methods['throw']
};
var iterable = {};
iterable[Symbol.iterator] = function(){ return iterator; }
return iterable;
}
function test() {
var result = "";
var iterable = global.__createIterableObject([1, 2, 3]);
for (var item of Object.create(iterable)) {
result += item;
}
return result === "123";
}
if (!test())
throw new Error("Test failed");