matcher.js 327 B

12345678910111213
  1. var extendOwn = require('./extendOwn.js');
  2. var isMatch = require('./isMatch.js');
  3. // Returns a predicate for checking whether an object has a given set of
  4. // `key:value` pairs.
  5. function matcher(attrs) {
  6. attrs = extendOwn({}, attrs);
  7. return function(obj) {
  8. return isMatch(obj, attrs);
  9. };
  10. }
  11. module.exports = matcher;