Update std.js

This commit is contained in:
Namhyeon Go 2022-04-11 11:08:40 +09:00 committed by GitHub
parent e1df66f6f7
commit 8eb7e2ede0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,10 +28,21 @@ if (!Function.prototype.GetResource) {
} }
} }
// MS JScript Enumerator to Array
/*
if (!Enumerator.prototype.toArray) { if (!Enumerator.prototype.toArray) {
Enumerator.prototype.toArray = function() { Enumerator.prototype.toArray = function() {
var items = [];
for (; !this.atEnd(); this.moveNext()) {
var item = this.item();
try {
items.push(item);
} catch (e) {}
}
return items;
};
}
if (!Enumerator.prototype.toArray2) {
Enumerator.prototype.toArray2 = function() {
var a = []; var a = [];
for (; !this.atEnd(); this.moveNext()) { for (; !this.atEnd(); this.moveNext()) {
var x = {}; var x = {};
@ -62,21 +73,6 @@ if (!Enumerator.prototype.toArray) {
return a; 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 // Global APIs