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