1 var baseGet = require('./baseGet'),
2 baseIsEqual = require('./baseIsEqual'),
3 baseSlice = require('./baseSlice'),
4 isArray = require('../lang/isArray'),
5 isKey = require('./isKey'),
6 isStrictComparable = require('./isStrictComparable'),
7 last = require('../array/last'),
8 toObject = require('./toObject'),
9 toPath = require('./toPath');
12 * The base implementation of `_.matchesProperty` which does not clone `srcValue`.
15 * @param {string} path The path of the property to get.
16 * @param {*} srcValue The value to compare.
17 * @returns {Function} Returns the new function.
19 function baseMatchesProperty(path, srcValue) {
20 var isArr = isArray(path),
21 isCommon = isKey(path) && isStrictComparable(srcValue),
22 pathKey = (path + '');
25 return function(object) {
30 object = toObject(object);
31 if ((isArr || !isCommon) && !(key in object)) {
32 object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
37 object = toObject(object);
39 return object[key] === srcValue
40 ? (srcValue !== undefined || (key in object))
41 : baseIsEqual(srcValue, object[key], undefined, true);
45 module.exports = baseMatchesProperty;