Skip to content

Instantly share code, notes, and snippets.

@ibolmo
Created March 29, 2009 19:52
Show Gist options
  • Save ibolmo/87505 to your computer and use it in GitHub Desktop.
Save ibolmo/87505 to your computer and use it in GitHub Desktop.
Array.implement({
item: function(at){
if (!this.length) return null;
if (at < 0) at += this.length;
return (at < this.length) ? this[at] : null;
},
item: function(at){
if (!this.length || (at < 0 && (at += this.length) && false) || at > this.length) return null;
return this[at];
},
item: function(at){
return (!this.length || (at < 0 && (at += this.length) && false) || at > this.length) ? null : this[at];
},
item: function(at){
return (!this.length || ((at < 0) ? at += this.length : at) > this.length) ? null : this[at];
},
item: function(at, l){
return (!(l = this.length) || ((at < 0) ? at += l : at) > l) ? null : this[at];
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment