From 8eb7e2ede00fe248bf99eada7cc83d4d078085f2 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Mon, 11 Apr 2022 11:08:40 +0900 Subject: [PATCH] Update std.js --- lib/std.js | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/lib/std.js b/lib/std.js index 9acefe7..251917b 100644 --- a/lib/std.js +++ b/lib/std.js @@ -28,10 +28,21 @@ if (!Function.prototype.GetResource) { } } -// MS JScript Enumerator to Array -/* 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; + }; +} + +if (!Enumerator.prototype.toArray2) { + Enumerator.prototype.toArray2 = function() { var a = []; for (; !this.atEnd(); this.moveNext()) { var x = {}; @@ -62,21 +73,6 @@ 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