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.
		
		
		
		
		
			
		
			
				
					18 lines
				
				447 B
			
		
		
			
		
	
	
					18 lines
				
				447 B
			| 
								 
											3 years ago
										 
									 | 
							
								define(['./keys'], function (keys) {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // Returns whether an object has a given set of `key:value` pairs.
							 | 
						||
| 
								 | 
							
								  function isMatch(object, attrs) {
							 | 
						||
| 
								 | 
							
								    var _keys = keys(attrs), length = _keys.length;
							 | 
						||
| 
								 | 
							
								    if (object == null) return !length;
							 | 
						||
| 
								 | 
							
								    var obj = Object(object);
							 | 
						||
| 
								 | 
							
								    for (var i = 0; i < length; i++) {
							 | 
						||
| 
								 | 
							
								      var key = _keys[i];
							 | 
						||
| 
								 | 
							
								      if (attrs[key] !== obj[key] || !(key in obj)) return false;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    return true;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  return isMatch;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								});
							 |