From 37110ca9cba7981eb943020abfbd086ced24eef2 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 22 Jul 2010 18:10:58 +0800 Subject: [PATCH] Array.js --- Array.js | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Array.js b/Array.js index 18c3aaa13c..bb4ebaf79d 100644 --- a/Array.js +++ b/Array.js @@ -33,5 +33,33 @@ Roo.applyIf(Array.prototype, { if(index != -1){ this.splice(index, 1); } + }, + /** + * Map (JS 1.6 compatibility) + * @param {Function} function to call + */ + map : function(fun /*, thisp*/) + { + var len = this.length >>> 0; + if (typeof fun != "function") + throw new TypeError(); + + var res = new Array(len); + var thisp = arguments[1]; + for (var i = 0; i < len; i++) + { + if (i in this) + res[i] = fun.call(thisp, this[i], i, this); + } + + return res; } -}); \ No newline at end of file + +}); + + + +if (!Array.prototype.map) +{ + Array.prototype. +} \ No newline at end of file -- 2.39.2