1var baseClone = require('../internal/baseClone'), 2 baseMatchesProperty = require('../internal/baseMatchesProperty'); 3 4/** 5 * Creates a function that compares the property value of `path` on a given 6 * object to `value`. 7 * 8 * **Note:** This method supports comparing arrays, booleans, `Date` objects, 9 * numbers, `Object` objects, regexes, and strings. Objects are compared by 10 * their own, not inherited, enumerable properties. 11 * 12 * @static 13 * @memberOf _ 14 * @category Utility 15 * @param {Array|string} path The path of the property to get. 16 * @param {*} srcValue The value to match. 17 * @returns {Function} Returns the new function. 18 * @example 19 * 20 * var users = [ 21 * { 'user': 'barney' }, 22 * { 'user': 'fred' } 23 * ]; 24 * 25 * _.find(users, _.matchesProperty('user', 'fred')); 26 * // => { 'user': 'fred' } 27 */ 28function matchesProperty(path, srcValue) { 29 return baseMatchesProperty(path, baseClone(srcValue, true)); 30} 31 32module.exports = matchesProperty; 33 34