diff options
| author | Scott Ostler <scottbot9000@gmail.com> | 2010-06-17 02:47:52 -0400 |
|---|---|---|
| committer | Scott Ostler <scottbot9000@gmail.com> | 2010-06-17 02:47:52 -0400 |
| commit | 437c7cd3ecff287a3aec3a0b08c850092c67e8dd (patch) | |
| tree | f4819b4ba2d43a47a82125e21e32fca8f720b1cc /static/tests/canvas2/jsplatformer5_files/Utils.js | |
| parent | c47183393b9271c05e7c947340c499bda7ef0bda (diff) | |
| parent | 0a4fdca2e4070771eec03c43bf99100fd09e5543 (diff) | |
Merge branch 'master' of ssh://dump.fm/pichat/repo
Diffstat (limited to 'static/tests/canvas2/jsplatformer5_files/Utils.js')
| -rw-r--r-- | static/tests/canvas2/jsplatformer5_files/Utils.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/static/tests/canvas2/jsplatformer5_files/Utils.js b/static/tests/canvas2/jsplatformer5_files/Utils.js new file mode 100644 index 0000000..0ec5cfa --- /dev/null +++ b/static/tests/canvas2/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; + } + } +} |
