X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=docs%2Fsrc%2FArray.js.html;fp=docs%2Fsrc%2FArray.js.html;h=cf37ed1dc105b09849ce9025cbb08820210ca249;hb=9ff8ded6bbbd258ecd646184ba26020874e2c085;hp=0000000000000000000000000000000000000000;hpb=2542b67d1a0768025056f2f330bfe50b64d1ad38;p=roojs1 diff --git a/docs/src/Array.js.html b/docs/src/Array.js.html new file mode 100644 index 0000000000..cf37ed1dc1 --- /dev/null +++ b/docs/src/Array.js.html @@ -0,0 +1,64 @@ +/home/alan/gitlive/roojs1/Array.js/* + * Based on: + * Ext JS Library 1.1.1 + * Copyright(c) 2006-2007, Ext JS, LLC. + * + * Originally Released Under LGPL - original licence link has changed is not relivant. + * + * Fork - LGPL + * <script type="text/javascript"> + */ + /** + * @class Array + */ +Roo.applyIf(Array.prototype, { + /** + * + * Checks whether or not the specified object exists in the array. + * @param {Object} o The object to check for + * @return {Number} The index of o in the array (or -1 if it is not found) + */ + indexOf : function(o){ + for (var i = 0, len = this.length; i < len; i++){ + if(this[i] == o) { return i; } + } + return -1; + }, + + /** + * Removes the specified object from the array. If the object is not found nothing happens. + * @param {Object} o The object to remove + */ + remove : function(o){ + var index = this.indexOf(o); + if(index != -1){ + this.splice(index, 1); + } + }, + /** + * Map (JS 1.6 compatibility) + * @param {Function} function to call + */ + map : function(fun ) + { + 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