Skip to content

Commit

Permalink
i-ecma: every() method added
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Varankin committed Jul 20, 2012
1 parent 615742d commit d4d2966
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions blocks-common/i-ecma/__array/i-ecma__array.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,24 @@ var ptp = Array.prototype,

return false;

},

/**
* Проверяет, удовлетворяет ли массив условию в callback
* @param {Function} callback
* @param {Object} [ctx=this] контекст вызова callback
* @returns {Boolean}
*/
every : function(callback, ctx) {

var i = -1, t = this, len = t.length;

while(++i < len)
if(i in t && !(ctx ? callback.call(ctx, t[i], i, t) : callback(t[i], i, t)))
return false;

return true;

}

};
Expand Down

0 comments on commit d4d2966

Please sign in to comment.