SHARE
TWEET

Untitled

a guest Jun 18th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. _['each'] = function(collection, iterator) {
  2.   if (Array.isArray(collection) === false && typeof(collection) ===
  3. 'object') {
  4.     var values = Object.values(collection);
  5.     var keys = Object.keys(collection);
  6.     for (let i = 0; i < values.length; i++) {
  7.       iterator(values[i], keys[i], collection, i);
  8.     }    
  9.   } else {
  10.     for (let i = 0; i < collection.length; i++) {
  11.       iterator(collection[i], i, collection);
  12.     }
  13.   }
  14. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top