Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 16fd136c59ce6ee17612863132ef386be3ec968f 1 parent 0ed93d4
Scott Kyle appden authored
Showing with 12 additions and 6 deletions.
  1. +12 −6 Source/Core/Core.js
18 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){
Please sign in to comment.
Something went wrong with that request. Please try again.