Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Iterate collection using callback _fn_,
- * passing both the value and index.
- *
- * @param {function} fn
- * @return {Collection}
- * @api public
- */
- each: function(fn) {
- try {
- if (this.arr.forEach)
- this.arr.forEach(fn)
- else
- for (var key in this.arr)
- if (this.arr.hasOwnProperty(key))
- fn(this.arr[key], key)
- }
- catch (e) {
- if (e != $break) throw e
- }
- return this
- }
Add Comment
Please, Sign In to add comment