You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					26 lines
				
				746 B
			
		
		
			
		
	
	
					26 lines
				
				746 B
			| 
								 
											3 years ago
										 
									 | 
							
								define(['./_optimizeCb', './_isArrayLike', './keys'], function (_optimizeCb, _isArrayLike, keys) {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // The cornerstone for collection functions, an `each`
							 | 
						||
| 
								 | 
							
								  // implementation, aka `forEach`.
							 | 
						||
| 
								 | 
							
								  // Handles raw objects in addition to array-likes. Treats all
							 | 
						||
| 
								 | 
							
								  // sparse array-likes as if they were dense.
							 | 
						||
| 
								 | 
							
								  function each(obj, iteratee, context) {
							 | 
						||
| 
								 | 
							
								    iteratee = _optimizeCb(iteratee, context);
							 | 
						||
| 
								 | 
							
								    var i, length;
							 | 
						||
| 
								 | 
							
								    if (_isArrayLike(obj)) {
							 | 
						||
| 
								 | 
							
								      for (i = 0, length = obj.length; i < length; i++) {
							 | 
						||
| 
								 | 
							
								        iteratee(obj[i], i, obj);
							 | 
						||
| 
								 | 
							
								      }
							 | 
						||
| 
								 | 
							
								    } else {
							 | 
						||
| 
								 | 
							
								      var _keys = keys(obj);
							 | 
						||
| 
								 | 
							
								      for (i = 0, length = _keys.length; i < length; i++) {
							 | 
						||
| 
								 | 
							
								        iteratee(obj[_keys[i]], _keys[i], obj);
							 | 
						||
| 
								 | 
							
								      }
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    return obj;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  return each;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								});
							 |