Lodash _.some() method

Beginner
⏱️ 6 min read
📚 Updated: May 2026
🎯 3 Code examples
🚀 3 Try-it labs
Lodash

What you’ll learn

  • How _.some(collection, predicate) detects whether any element passes your test.
  • Short-circuit wins and why predicates should stay side-effect safe.
  • How Lodash compares to native Array.prototype.some and to _.every—especially on empty inputs.
  • Try each example in the editor (?tryit=1, 2, 3) with Lodash from a CDN.

Prerequisites

Read _.every() for the universal-quantifier twin—empty-collection semantics flip between the two helpers.

  • You can write predicates that return meaningful truthy or falsy values.
  • You can open Try-it labs or run snippets locally.

Overview

_.some captures existential checks—spot banned roles, detect outages in telemetry batches, or bail early when any invoice crosses a threshold.

Short-circuits on success

First passing element finishes the scan—ideal when tests cost IO or CPU.

Iteratee sugar

Lean on functions, property paths, or partial object templates like filter or every.

Arrays or objects

Walk lists or keyed maps with the same predicate signature.

Syntax

javascript
_.some(collection, predicate)
  • collection: array, array-like, or plain object Lodash can iterate.
  • predicate: invoked as (value, index|key, collection); truthy results succeed immediately.
  • Returns: boolean—true if any invocation is truthy; otherwise false (including empty collections).
1

Detect any value above a threshold

Perfect for guard clauses—stop processing heavy pipelines once one anomaly appears.

javascript
import some from "lodash/some";

some([1, 2, 3], (n) => n > 2);
// → true
Try it Yourself
2

Partial object match iteratee

Lodash highlights any row whose shape satisfies the template—here, at least one inactive account.

javascript
import some from "lodash/some";

some(
  [
    { id: 1, role: "editor", active: true },
    { id: 2, role: "viewer", active: false }
  ],
  { active: false }
);
// → true
Try it Yourself
3

Empty collections never satisfy

With zero elements the predicate never runs—Lodash returns false, unlike vacuous every.

javascript
import some from "lodash/some";

some([], () => true);
// → false
Try it Yourself

📋 _.some vs every, native some

APIOutcomeBest when
_.some(collection, predicate)Any element passesExistential validation across arrays or objects
_.every(collection, predicate)All elements passUniversal validation; empty → true
array.some(predicate)Any element passesPure arrays without Lodash iteratee sugar

Pitfalls to avoid

Empty

Always false

If “no data” should trigger alerts, check _.size before relying on some.

Effects

Skipped tail elements

Successful hits stop iteration—avoid mutating external state inside predicates unless intentional.

Coercion

Truthy surprises

Return explicit booleans when readability beats terse callbacks.

❓ FAQ

No. Lodash only reads values while evaluating your predicate; the collection is unchanged.
false—the predicate never succeeds because no elements exist, matching native Array.some.
Yes. Once an element satisfies the predicate, Lodash returns true without visiting the rest.
some needs one truthy hit; every requires all hits. Empty collections yield false vs true respectively.
Yes—Lodash accepts iteratee forms such as property names, path arrays, or partial object matches like other collection methods.

Summary

  • Purpose: _.some(collection, predicate) returns whether at least one element satisfies the predicate.
  • Contrast: pair with every for all-or-nothing rules; remember empties yield false here.
  • Next: Lodash _.sortBy(), Lodash _.size() (previous), or collection hub.
Did you know?

For an empty collection, Lodash _.some returns false—matching Array.prototype.some: nothing satisfies the predicate because nothing is visited.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful