> For the complete documentation index, see [llms.txt](https://lodash.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lodash.shujuwajue.com/lang/conformsto.md).

# \_.conformsTo（对象断言判断）

**语法：**

```javascript
_.conformsTo(object, source)
```

**源代码链接：**[source](https://github.com/lodash/lodash/blob/4.17.10/lodash.js#L11147)

**npm包链接：**[npm package](https://www.npmjs.com/package/lodash.conformsto)

**描述：**

通过调用断言`source`的属性与`object`的相应属性值，检查`object`是否符合`source`。当`source`偏应用时，这种方法和[`_.conforms`](https://lodash.com/docs/4.17.10#conforms)函数是等价的。

> **注意:** 当`source`为偏应用时，这种方法等价于[`_.conforms`](https://lodash.com/docs/4.17.10#conforms)。
>
> 参考：[偏函数与偏应用函数](https://blog.csdn.net/yuanguangyu1221/article/details/71307664)

**开始版本：**&#x34;.14.0

**参数：**

* `object (Object)`: 要检查的对象。
* `source (Object)`: 要断言属性是否符合的对象。&#x20;

**返回值：**

* `(boolean)`: 如果 object 符合，返回 true，否则 false。

**例子：**

```javascript
var object = { 'a': 1, 'b': 2 };

_.conformsTo(object, { 'b': function(n) { return n > 1; } });
// => true

_.conformsTo(object, { 'b': function(n) { return n > 2; } });
// => false
```
