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.
		
		
		
		
		
			
		
			
				
					
					
						
							31 lines
						
					
					
						
							980 B
						
					
					
				
			
		
		
	
	
							31 lines
						
					
					
						
							980 B
						
					
					
				define(['./_isArrayLike', './values', './_cb', './each'], function (_isArrayLike, values, _cb, each) {
 | 
						|
 | 
						|
  // Return the maximum element (or element-based computation).
 | 
						|
  function max(obj, iteratee, context) {
 | 
						|
    var result = -Infinity, lastComputed = -Infinity,
 | 
						|
        value, computed;
 | 
						|
    if (iteratee == null || (typeof iteratee == 'number' && typeof obj[0] != 'object' && obj != null)) {
 | 
						|
      obj = _isArrayLike(obj) ? obj : values(obj);
 | 
						|
      for (var i = 0, length = obj.length; i < length; i++) {
 | 
						|
        value = obj[i];
 | 
						|
        if (value != null && value > result) {
 | 
						|
          result = value;
 | 
						|
        }
 | 
						|
      }
 | 
						|
    } else {
 | 
						|
      iteratee = _cb(iteratee, context);
 | 
						|
      each(obj, function(v, index, list) {
 | 
						|
        computed = iteratee(v, index, list);
 | 
						|
        if (computed > lastComputed || (computed === -Infinity && result === -Infinity)) {
 | 
						|
          result = v;
 | 
						|
          lastComputed = computed;
 | 
						|
        }
 | 
						|
      });
 | 
						|
    }
 | 
						|
    return result;
 | 
						|
  }
 | 
						|
 | 
						|
  return max;
 | 
						|
 | 
						|
});
 |