From e890d6d91db6d716beeb22c94d6bf0a9d88f1ef5 Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Thu, 17 Jun 2010 00:34:02 -0400 Subject: sostler prod commit --- static/tests/canvas1/jsplatformer5_files/Utils.js | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 static/tests/canvas1/jsplatformer5_files/Utils.js (limited to 'static/tests/canvas1/jsplatformer5_files/Utils.js') diff --git a/static/tests/canvas1/jsplatformer5_files/Utils.js b/static/tests/canvas1/jsplatformer5_files/Utils.js new file mode 100644 index 0000000..0ec5cfa --- /dev/null +++ b/static/tests/canvas1/jsplatformer5_files/Utils.js @@ -0,0 +1,27 @@ +/** + Removes a number of objects from the array + @param from The first object to remove + @param to (Optional) The last object to remove +*/ +Array.prototype.remove = function(/**Number*/ from, /**Number*/ to) +{ + var rest = this.slice((to || from) + 1 || this.length); + this.length = from < 0 ? this.length + from : from; + return this.push.apply(this, rest); +}; + +/** + Removes a specific object from the array + @param object The object to remove +*/ +Array.prototype.removeObject = function(object) +{ + for (var i = 0; i < this.length; ++i) + { + if (this[i] === object) + { + this.remove(i); + break; + } + } +} -- cgit v1.2.3-70-g09d2