mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-14 13:41:05 +00:00
Update std.js
This commit is contained in:
parent
e1df66f6f7
commit
8eb7e2ede0
30
lib/std.js
30
lib/std.js
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user