> 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/collection/some.md). Agents can also search and read this documentation through its [MCP server](https://lodash.shujuwajue.com/~gitbook/mcp).

# \_.some（迭代断言函数，遇true停）

**语法：**

```javascript
_.some(collection, [predicate=_.identity])
```

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

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

**描述：**

通过`predicate`（断言函数） 检查`collection`（集合）中的元素是否存在**任意**truthy（真值）的元素，一旦`predicate`（断言函数） 返回 truthy（真值），遍历就停止。 predicate 调用3个参数：*(value, index|key, collection)*。

**开始版本：**&#x30;.1.0

**参数：**

* `collection (Array|Object)`: 用来迭代的集合。
* `[predicate=_.identity] (Array|Function|Object|string)`: 每次迭代调用的函数。

**返回值：**

* `(boolean)`: 如果任意元素经 predicate 检查都为 truthy（真值），返回 true ，否则返回 false 。

**例子：**

```javascript
_.some([null, 0, 'yes', false], Boolean);
// => true

var users = [
  { 'user': 'barney', 'active': true },
  { 'user': 'fred',   'active': false }
];

// The `_.matches` iteratee shorthand.
_.some(users, { 'user': 'barney', 'active': false });
// => false

// The `_.matchesProperty` iteratee shorthand.
_.some(users, ['active', false]);
// => true

// The `_.property` iteratee shorthand.
_.some(users, 'active');
// => true
```
