daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest May 17th, 2018 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   /**
  2.    * Iterate collection using callback _fn_,
  3.    * passing both the value and index.
  4.    *
  5.    * @param  {function} fn
  6.    * @return {Collection}
  7.    * @api public
  8.    */
  9.  
  10.   each: function(fn) {
  11.     try {
  12.       if (this.arr.forEach)
  13.         this.arr.forEach(fn)
  14.       else
  15.         for (var key in this.arr)
  16.           if (this.arr.hasOwnProperty(key))
  17.             fn(this.arr[key], key)
  18.     }
  19.     catch (e) {
  20.       if (e != $break) throw e
  21.     }
  22.     return this
  23.   }
RAW Paste Data
Top