Permalink
Browse files

Array.each chains to keep consistency with the rest of our array methods

  • Loading branch information...
appden committed May 10, 2010
1 parent 0ed93d4 commit 16fd136c59ce6ee17612863132ef386be3ec968f
Showing with 12 additions and 6 deletions.
  1. +12 −6 Source/Core/Core.js
View
@@ -294,15 +294,21 @@ Object.extend('forEach', function(object, fn, bind){
Object.each = Object.forEach;
Array.implement('forEach', function(fn, bind){
for (var i = 0, l = this.length; i < l; i++){
if (i in this) fn.call(bind, this[i], i, this);
Array.implement({
forEach: function(fn, bind){
for (var i = 0, l = this.length; i < l; i++){
if (i in this) fn.call(bind, this[i], i, this);
}
},
each: function(fn, bind){
Array.forEach(this, fn, bind);
return this;
}
});
Array.each = Array.forEach;
Array.prototype.each = Array.prototype.forEach;
// Array & Object cloning, Object merging and appending
var cloneOf = function(item){

0 comments on commit 16fd136

Please sign in to comment.