Lodash _.overSome() Method

Beginner
⏱️ 8 min read
📚 Updated: Jul 2026
🎯 6 Examples + 3 Try It
Util utilities

What You’ll Learn

By the end of this tutorial, you’ll use Lodash’s _.overSome() to build reusable OR-style predicates—true when at least one rule passes.

01

Core Syntax

_.overSome([predicates])

02

OR logic

Any truthy wins.

03

Same args

Like overEvery.

04

Boolean

Pass / fail.

05

Shorthands

matches objects.

06

vs overEvery

Any vs all.

What Is _.overSome()?

_.overSome(predicates) is the OR counterpart to _.overEvery(). It returns a combinator that runs every predicate on the same arguments and yields true if at least one result is truthy.

💡
Beginner tip — array form is clearest

Write _.overSome([isEven, isGt10]). Lodash also accepts _.overSome(isEven, isGt10) as separate arguments, but the array form matches the docs and works cleanly with matches shorthands.

Use overSome when multiple alternative conditions are acceptable—role checks, flexible input validation, or filters where matching any rule is enough.

📝 Syntax

Pass predicates as an array (recommended) or as separate arguments:

javascript
_.overSome([predicates = [_.identity]])



// also valid:

_.overSome(predicateA, predicateB)

Syntax Rules

  • predicates — functions or shorthands; defaults to [_.identity].
  • Return value — combinator returning true or false.
  • Same arguments — each predicate receives the full outer argument list.
  • Short-circuit — stops at the first truthy predicate.
  • Shorthands — objects use _.matches; [path, value] uses _.matchesProperty.
javascript
import overSome from "lodash/overSome";



const isEvenOrGt10 = overSome([

  (n) => n % 2 === 0,

  (n) => n > 10,

]);



isEvenOrGt10(8);

// true

⚡ Quick Reference

TaskCode patternNotes
Even OR > 10_.overSome([isEven, gt10])OR combo
Official demo_.overSome([Boolean, isFinite])See null case
Role check_.overSome([isAdmin, isEditor])Either role OK
matches OR_.overSome([{ a: 1 }, { a: 2 }])Docs pattern
Filter (any rule)_.filter(items, combo)vs overEvery
All must pass_.overEvery([...])AND instead
Returns
Function

Predicate

Logic
OR

Any truthy

Output
Boolean

Pass / fail

Category
Util

Predicate

🧰 Parameters

Arguments to _.overSome() and the combinator it returns:

predicates Optional

Array of predicate functions or shorthands. Defaults to [_.identity].

_.overSome([fn1, fn2])
rest args Alternate

Lodash flattens multiple function arguments—_.overSome(a, b) works but array form is clearer.

_.overSome(fn1, fn2)
returned fn Combinator

Returns true when any predicate is truthy on the given arguments.

combo(value)
matches list Shorthand

[{ a: 1 }, { a: 2 }] passes if the argument matches either partial object.

_.overSome([{ a: 1 }, { a: 2 }])

For “any element in a collection passes one test” use _.some(collection, predicate)—overSome builds multi-rule predicates on one value.

Examples Gallery

Practical _.overSome() patterns with copy-ready code, sample output, and interactive Try It Yourself labs.

📚 Getting Started

Even OR greater than ten—the classic OR predicate.

Example 1 — Even or greater than ten

Pass when either rule succeeds on the same number.

javascript
const isEvenOrGt10 = _.overSome([

  (n) => n % 2 === 0,

  (n) => n > 10,

]);



console.log(isEvenOrGt10(8));

console.log(isEvenOrGt10(15));

console.log(isEvenOrGt10(3));

// true  — even

// true  — > 10

// false — neither
Try It Yourself

How It Works

8 passes via even; 15 passes via > 10; 3 fails both. Short-circuit stops at the first truthy predicate.

Example 2 — Official Boolean + isFinite

Note why null returns true—only one predicate needs to pass.

javascript
const combo = _.overSome([Boolean, Number.isFinite]);



console.log(combo("1"));

console.log(combo(null));

console.log(combo(NaN));

// true  — both pass for "1"

// true  — isFinite(null) is true

// false — both fail for NaN
Try It Yourself

How It Works

Same official trio as overEvery—but OR logic means null passes because Number.isFinite(null) is true even when Boolean(null) is false.

📈 Practical Patterns

Authorization, flexible validation, and filtering.

Example 3 — Admin or editor access

Either role is enough—classic OR authorization.

javascript
const isAuthorized = _.overSome([

  (user) => user.role === "admin",

  (user) => user.role === "editor",

]);



console.log(isAuthorized({ role: "admin" }));

console.log(isAuthorized({ role: "viewer" }));

// true

// false

How It Works

Replace long if (role === 'admin' || role === 'editor') chains with one reusable predicate.

Example 4 — Accept multiple input shapes

Non-empty string, non-empty array, or non-empty object—all valid.

javascript
const isValidInput = _.overSome([

  (input) => typeof input === "string" && input.length > 0,

  (input) => Array.isArray(input) && input.length > 0,

  (input) =>

    input !== null &&

    typeof input === "object" &&

    Object.keys(input).length > 0,

]);



console.log(isValidInput("hello"));

console.log(isValidInput([1, 2]));

console.log(isValidInput({ a: 1 }));

console.log(isValidInput(""));

// true, true, true, false

How It Works

Each predicate describes an acceptable shape. The combinator passes when any shape matches.

Example 5 — Filter when any condition matches

Keep items that are active or have stock—different from overEvery (which would require both).

javascript
const items = [

  { name: "A", status: "active", quantity: 0 },

  { name: "B", status: "draft", quantity: 5 },

  { name: "C", status: "draft", quantity: 0 },

];



const isActive = (item) => item.status === "active";

const hasStock = (item) => item.quantity > 0;



console.log(_.filter(items, _.overSome([isActive, hasStock])));

// A (active), B (stock) — C excluded
Try It Yourself

How It Works

With overEvery, only items both active and in stock would pass. overSome widens the net to OR logic.

🚀 Beyond the Basics

overSome vs overEvery on the same value.

Example 6 — overSome vs overEvery on n = 8

Same two rules—opposite boolean results when only one rule passes.

javascript
const rules = [(n) => n % 2 === 0, (n) => n > 10];



console.log(_.overSome(rules)(8));

console.log(_.overEvery(rules)(8));

console.log(_.overSome(rules)(15));

console.log(_.overEvery(rules)(15));

// 8:  true, false  — even but not > 10

// 15: true, false — > 10 but not even

When to use which

Need every rule? overEvery. Need any acceptable alternative? overSome.

🧠 How _.overSome() Works

1

Normalize predicates

Flatten arguments, convert shorthands to functions.

Setup
2

Return combinator

A reusable predicate for guards, filters, and tests.

Factory
3

Run until one passes

Each predicate gets the same args; stop at first truthy result.

Evaluate
=

true or false

true if any predicate passed; else false.

📝 Notes

  • overSome is OR—use overEvery when every rule must pass.
  • Prefer _.overSome([fn1, fn2]) over passing a nested array by mistake.
  • Official Boolean + isFinite behaves differently under OR vs AND—read test cases carefully.
  • matches shorthands: _.overSome([{ a: 1 }, { a: 2 }]) from Lodash docs.
  • Do not confuse with _.some(array, fn)—that tests collection elements, not multiple rules on one value.
  • Next in the series: _.property()—property path getters.

Conclusion

_.overSome() packages OR-style rules into one predicate—ideal when several alternative conditions are valid. Pair it with clear, small predicates and reuse the combinator across filters and guards.

Choose overEvery when all rules must pass; choose overSome when any single pass is enough.

💡 Best Practices

✅ Do

  • Name combinators by intent: isAuthorized, isValidInput
  • Use array form: _.overSome([fn1, fn2])
  • Put cheapest checks first for short-circuit wins
  • Document which alternatives each predicate represents
  • Pick overEvery when all rules are required

❌ Don’t

  • Use overSome when every rule must pass—use overEvery
  • Assume AND behavior in filters without reading the combinator
  • Confuse with _.some(collection)
  • Mix unrelated predicates without comments
  • Expect an array result—that is _.over

Key Takeaways

Knowledge Unlocked

Five things to remember about _.overSome()

Use these points when any acceptable rule is enough.

5
Core concepts
🔄 02

Same args

All predicates.

Mechanics
03

Boolean

Pass/fail.

Output
📝 04

Shorthands

matches OR.

Iteratee
🛠 05

overEvery

AND twin.

Compare

❓ Frequently Asked Questions

_.overSome(predicates) returns a new function. When you call it with arguments, Lodash runs every predicate with those same arguments and returns true if at least one result is truthy—logical OR across rules.
overEvery requires all predicates to pass (AND). overSome requires only one to pass (OR). Use overEvery for strict validation; overSome for alternative acceptable cases.
Lodash accepts multiple function arguments—_.overSome(fn1, fn2)—or a single array—_.overSome([fn1, fn2]). Prefer the array form for clarity, especially with shorthands.
_.overSome([Boolean, Number.isFinite])('1') is true. null is true because isFinite(null) is true even though Boolean(null) is false. NaN is false because both checks fail.
_.some(collection, predicate) tests whether any element in a collection passes one predicate. _.overSome builds a predicate combinator—you pass multiple rules that all run on the same value.
Use it when several different conditions are acceptable—admin OR editor roles, even OR greater-than-ten numbers, or multiple input shapes for validation.
Did you know?

Lodash documents _.overSome([{ a: 1 }, { a: 2 }]) alongside [['a', 1], ['a', 2]]—multiple matches shorthands combined with OR, the same way you would hand-write matches(a) || matches(b).

Practice _.overSome() in the Live Editor

Try even-or-greater-than-ten, the official Boolean/isFinite demo, and OR-style filters.

Open Try It editor →

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