mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-12 20:51:03 +00:00
Update std.js
This commit is contained in:
parent
cfb434d1c0
commit
3b157000f1
32
lib/std.js
32
lib/std.js
|
@ -10,7 +10,6 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
// Polyfills
|
// Polyfills
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
if (!Function.prototype.GetResource) {
|
if (!Function.prototype.GetResource) {
|
||||||
Function.prototype.GetResource = function(ResourceName) {
|
Function.prototype.GetResource = function(ResourceName) {
|
||||||
if (!this.Resources) {
|
if (!this.Resources) {
|
||||||
|
@ -28,37 +27,16 @@ 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 a = [];
|
var items = [];
|
||||||
for (; !this.atEnd(); this.moveNext()) {
|
for (; !this.atEnd(); this.moveNext()) {
|
||||||
var x = {};
|
var item = this.item();
|
||||||
var b = new Enumerator(this.item().Properties_);
|
|
||||||
for (; !b.atEnd(); b.moveNext()) {
|
|
||||||
var c = b.item();
|
|
||||||
if (typeof c.value !== "unknown") {
|
|
||||||
try {
|
try {
|
||||||
x[c.name] = c.value.toString();
|
items.push(item);
|
||||||
} catch (e) {
|
} catch (e) {}
|
||||||
x[c.name] = c.value;
|
|
||||||
}
|
}
|
||||||
} else {
|
return items;
|
||||||
var i = 0, d = [];
|
|
||||||
while (true) {
|
|
||||||
try {
|
|
||||||
d.push(c.value(i));
|
|
||||||
i++;
|
|
||||||
} catch (e) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x[c.name] = d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
a.push(x);
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user