Build a new object by keeping properties where a predicate returns truthy. Part of Lodash Object (stable — not deprecated). The predicate is invoked as (value, key). Opposite of _.omitBy.
Pass the object and path or keys shown below. Check whether the helper mutates or returns a new object.
Syntax
Call _.pickBy. Start with this line.
Lodash
_.pickBy(object, [predicate=_.identity])
Call
What it does
_.pickBy(object, [predicate=_.identity])
Primary signature.
_.pickBy(object)
Work with an object’s keys, values, or paths.
Prefer import pickBy from "lodash/pickBy" when you want a smaller bundle.
Library declarations
Lodash
_.pickBy(object, [predicate=_.identity])
Parameters
Parameter
Description
object
Required. Source object to filter
predicate
Optional. Invoked as (value, key); default _.identity
pickBy. Best when the rule depends on value or a pattern.
Different results. Name vs number filter keep different fields.
Choose. Prefer the shorter, clearer API for the job.
Compatibility
Browser & Runtime Support
_.pickBy is a Lodash Object helper available in 4.x. It runs anywhere Lodash runs — modern browsers (via CDN or bundle) and Node.js / Bun / Deno with npm install lodash. Native equivalents loop Object.keys and copy keys the predicate accepts.
✓ Stable · Lodash 4.x
_.pickBy()
Available in [email protected] full builds and the lodash/pickBy modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.
100%With Lodash 4.x
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.pickByLodash 4.x
Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import pickBy from "lodash/pickBy" for smaller builds. Use pick for fixed key lists; omitBy when you want to drop matches.
Frequently Asked Questions
_.pickBy(object, [predicate]) builds a new object from own enumerable string keys, keeping any property where the predicate returns a truthy value. Official example: _.pickBy({ a: 1, b: '2', c: 3 }, _.isNumber) → { a: 1, c: 3 }.
The predicate is invoked as predicate(value, key). Check the value for content rules, or the key for name-based rules.
No. It returns a new object and leaves the source unchanged.
_.pick() keeps a fixed list of paths/keys. _.pickBy() decides per property with a runtime predicate.
They are opposites. _.pickBy() keeps where the predicate is truthy; _.omitBy() drops where the predicate is truthy.
The default is _.identity, so only truthy values are kept. Prefer an explicit predicate when 0 or false must stay.