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.
		
		
		
		
		
			
		
			
				
					21 lines
				
				581 B
			
		
		
			
		
	
	
					21 lines
				
				581 B
			| 
								 
											3 years ago
										 
									 | 
							
								define(['./_getLength'], function (_getLength) {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // Converts lists into objects. Pass either a single array of `[key, value]`
							 | 
						||
| 
								 | 
							
								  // pairs, or two parallel arrays of the same length -- one of keys, and one of
							 | 
						||
| 
								 | 
							
								  // the corresponding values. Passing by pairs is the reverse of `_.pairs`.
							 | 
						||
| 
								 | 
							
								  function object(list, values) {
							 | 
						||
| 
								 | 
							
								    var result = {};
							 | 
						||
| 
								 | 
							
								    for (var i = 0, length = _getLength(list); i < length; i++) {
							 | 
						||
| 
								 | 
							
								      if (values) {
							 | 
						||
| 
								 | 
							
								        result[list[i]] = values[i];
							 | 
						||
| 
								 | 
							
								      } else {
							 | 
						||
| 
								 | 
							
								        result[list[i][0]] = list[i][1];
							 | 
						||
| 
								 | 
							
								      }
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    return result;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  return object;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								});
							 |