企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## matches + [link](./matches "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L13344 "View in source.") + [npm](https://www.npmjs.com/package/lodash.matches "See the npm package.") ``` _.matches(source) ``` 创建一个深比较的方法来比较给定的对象和 `source` 对象。 如果给定的对象拥有相同的属性值返回 `true`,否则返回 `false` **注意:** 这个方法支持以 `_.isEqual` 的方式比较相同的值。 ### 参数 1. source (Object) 要匹配的源对象 ### 返回值 (Function) 返回新的函数 ### 示例 ``` var users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user': 'fred', 'age': 40, 'active': false } ]; _.filter(users, _.matches({ 'age': 40, 'active': false })); // => [{ 'user': 'fred', 'age': 40, 'active': false }] ```