1234567891011121314151617181920 |
- var forOwn = require('./forOwn');
- /**
- * checks if a object contains all given properties/values
- */
- function matches(target, props){
- // can't use "object/every" because of circular dependency
- var result = true;
- forOwn(props, function(val, key){
- if (target[key] !== val) {
- // break loop at first difference
- return (result = false);
- }
- });
- return result;
- }
- module.exports = matches;
|