Update std.js

This commit is contained in:
Namhyeon Go 2022-03-13 18:57:36 +09:00 committed by GitHub
parent 1716fc19d5
commit 9de4fa64f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,6 +29,7 @@ if (!Function.prototype.GetResource) {
}
// MS JScript Enumerator to Array
/*
if (!Enumerator.prototype.toArray) {
Enumerator.prototype.toArray = function() {
var a = [];
@ -61,6 +62,21 @@ if (!Enumerator.prototype.toArray) {
return a;
};
}
*/
// old version
if (!Enumerator.prototype.toArray) {
Enumerator.prototype.toArray = function() {
var items = [];
for (; !this.atEnd(); this.moveNext()) {
var item = this.item();
try {
items.push(item);
} catch (e) {}
}
return items;
};
}
/////////////////////////////////////////////////////////////////////////////////
// Global APIs