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.
Fundamentals
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.
Foundation
📝 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
Cheat Sheet
⚡ Quick Reference
Task
Code pattern
Notes
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
Reference
🧰 Parameters
Arguments to _.overSome() and the combinator it returns:
predicatesOptional
Array of predicate functions or shorthands. Defaults to [_.identity].
_.overSome([fn1, fn2])
rest argsAlternate
Lodash flattens multiple function arguments—_.overSome(a, b) works but array form is clearer.
_.overSome(fn1, fn2)
returned fnCombinator
Returns true when any predicate is truthy on the given arguments.
combo(value)
matches listShorthand
[{ 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.
Hands-On
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.
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
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
📤 Console output:
true
false
true
false
When to use which
Need every rule? overEvery. Need any acceptable alternative? overSome.
Compare
📋 _.overSome vs related patterns
Topic
_.overSome()
_.overEvery()
_.over()
_.some()
Logic
Any truthy (OR)
All truthy (AND)
Collect all
Any element passes
Returns
Boolean
Boolean
Array
Boolean
Builds
Predicate combo
Predicate combo
Multi-fn combo
Tests collection
Short-circuit
First true
First false
No
First true
Example
admin OR editor
admin AND verified
[max, min]
_.some(arr, fn)
🧠 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.
Important
📝 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.
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.
Wrap Up
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.
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
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about _.overSome()
Use these points when any acceptable rule is enough.
5
Core concepts
📦01
OR
Any truthy.
Logic
🔄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).