Return a copy of the object, filtered to only have values for the whitelisted keys (or an array of valid keys). Alternatively accepts a predicate indicating which keys to pick (official Underscore docs). Stable helper — not deprecated. Does not mutate the source.
Pass the required arguments shown below. Underscore object helpers usually return a new value — check whether the source object is mutated.
Syntax
Call _.pick. Start with this line.
Underscore
_.pick(object, *keys) or predicate Returns New object with only whitelisted keys Official example _.pick({name, age, userid}, "name", "age")
Call
What it does
_.pick(object, *keys) or predicate Returns New object with only whitelisted keys Official example _.pick({name, age, userid}, "name", "age")
Primary signature.
_.pick(...)
Call with the arguments your case needs.
Load Underscore with import _ from "underscore" (or the UMD CDN build) so these helpers are available as _.
Library declarations
Underscore
_.pick(object, *keys) or predicate Returns New object with only whitelisted keys Official example _.pick({name, age, userid}, "name", "age")
Parameters
Parameter
Description
object
Required. Source to copy from
*keys / array
Optional. Property names to whitelist
predicate
Optional. (value, key, object) → true means keep
Return Value
Return Value
Description
*
New object with only picked keys
Underscore.js Examples
Example 1 — Official: Keep name and age
The docs whitelist two keys and drop everything else.
Choose. Prefer pick when the keep list is shorter; omit when the drop list is shorter.
Compatibility
Browser & Runtime Support
_.pick ships with Underscore.js (1.x). It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore. Handy for arrays of keys and predicates when object rest is not enough.
✓ Stable · Underscore 1.x
_.pick()
Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded.
100%With Underscore 1.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
_.pickUnderscore 1.x+
Bottom line: Safe for production once Underscore is on the page or in your bundle. Not a native browser API by itself — load Underscore first. Prefer a pinned CDN version (e.g. [email protected]).
Frequently Asked Questions
_.pick(object, *keys) returns a copy of the object with only the whitelisted keys. Official example: _.pick({name: 'moe', age: 50, userid: 'moe1'}, 'name', 'age') returns {name: 'moe', age: 50}.
No. It returns a new object. The source is left untouched.
They are opposites. _.pick keeps only the keys you name (whitelist). _.omit removes the keys you name (blacklist).
Yes. A predicate (value, key, object) keeps every property for which it returns true — useful to pick by type or pattern.
Missing keys are ignored. They do not appear in the result and no error is thrown.
No. It is a stable Underscore object helper. Load Underscore 1.x and call _.pick(object, *keys).