Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / baseMatches.js
1 var baseIsMatch = require('./baseIsMatch'),
2     getMatchData = require('./getMatchData'),
3     toObject = require('./toObject');
4
5 /**
6  * The base implementation of `_.matches` which does not clone `source`.
7  *
8  * @private
9  * @param {Object} source The object of property values to match.
10  * @returns {Function} Returns the new function.
11  */
12 function baseMatches(source) {
13   var matchData = getMatchData(source);
14   if (matchData.length == 1 && matchData[0][2]) {
15     var key = matchData[0][0],
16         value = matchData[0][1];
17
18     return function(object) {
19       if (object == null) {
20         return false;
21       }
22       return object[key] === value && (value !== undefined || (key in toObject(object)));
23     };
24   }
25   return function(object) {
26     return baseIsMatch(object, matchData);
27   };
28 }
29
30 module.exports = baseMatches;