Ramda’s R.pickAll() answers a schema question: give me this exact set of keys, and fill blanks with undefined. You pass a list of names, then the object. You get a new object with every listed property. Native JavaScript’s cousin is a destructure: const { a, e, f } = obj then rebuild { a, e, f }. Missing names become undefined there too. pickAll is data-last, so R.pickAll(['id', 'name', 'email']) is already a function of one object — ready for R.map or R.pipe.
The official sample is the whole idea. R.pickAll(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}) is {a: 1, d: 4} — same leftover as R.pick when every name exists. Ask for e and f as well and pickAll keeps them: {a: 1, e: undefined, f: undefined}. pick would have skipped those holes. Need values as an array? That is R.props. Need a predicate? Next is R.pickBy.
Syntax
Call R.pickAll. Start with this line.
Ramda
R.pickAll(names, obj)
Call
What it does
R.pickAll(names, obj)
Primary signature.
R.pickAll(...)
Call the object helper.
Prefer import { pickAll } from "ramda" when you want a named import.
Library declarations
Ramda
R.pickAll(names, obj)
Parameters
Parameter
Description
names
Required. Array. String property names to copy onto the new object. Every name is assigned, even if missing. An empty list yields {}.
obj
Required. Object. The source. The source is never mutated. Nested values stay shared by reference. null or undefined still produce keys whose values are unde...
Return Value
Return Value
Description
Object
A new object with a property for every name. Missing names (and stored undefined) are undefined. Key order follows names.
Ramda Examples
📚 Getting Started
The official Ramda sample, then a real schema with curry and a name that is not on the object.
Example 1 — Official PickAll
When every name exists, the leftover matches pick. When names are missing, pickAll still writes undefined.
Ramda copies a and d when they exist. e and f are not on the source, so their values are undefined, but the keys still exist. That is the docs sample from ramdajs.com.
Example 2 — Schema Fields, Curry
Fill the names list to get a function of one object. Extra secrets stay on the original. A missing email still occupies a key.
email is not on orig, but pickAll still writes it. password was never in the schema. Native rest would look the same for the listed keys; pickAll names that schema once for R.map.
📈 Practical Patterns
Compare pick, props, and JSON.stringify, then prove the copy is shallow, then map a schema over many rows.
Example 3 — vs pick, props, and JSON
pick skips the hole. pickAll keeps it. props returns values. JSON.stringify hides undefined keys.
That JSON line is the gotcha. The leftover still has e. If you log with JSON.stringify alone, the hole looks gone. Use 'e' in all or print String(all.e) when you need to see it.
Example 4 — Shallow Copy, Nested Shared
The outer object is new. Nested objects stay the same reference. Mutating a nested field later still changes the original nested value.
pickAll copies property values as-is. profile is still the same object. Clone nested branches yourself (or use R.clone) if later writes must not leak. That is the same shallow rule as R.pick.
Example 5 — Map, Empty List, Array Indexes
Fill the names and map over rows. An empty names list is {}. Picking array indexes yields a plain object with holes for missing indexes.
Because pickAll is arity 2, filling names leaves a function of one object, ready for R.map. An empty list copies nothing. The last call walks array indexes as object keys, so index '2' is a hole, not a shorter array.
Compatibility
Browser Support
R.pickAll() is ordinary JavaScript once Ramda is loaded. Logos use the shared browser-image-sprite.png sprite from this project.
✓ Ramda 0.1.0+ · Any JS runtime
Ramda.js R.pickAll()
Load Ramda 0.1.0 or later via CDN or npm, then call R.pickAll with a names array and an object. No extra browser API is required.
100%With Ramda 0.1.0+
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
R.pickAll()Universal
Bottom line: Safe in any project that includes Ramda 0.1.0 or later. Use a CDN build such as ramda.min.js in the browser or install ramda from npm for Node. These labs use [email protected].
Frequently Asked Questions
R.pickAll(names, obj) returns a new object with every listed key. If a name is missing, the property is still copied as undefined. Added in v0.1.0. The original object is not mutated.
pick skips missing names. pickAll keeps them as undefined. props returns an array of values (also undefined for misses), not a new object.
JSON has no undefined. JSON.stringify({a: 1, e: undefined}) is {"a":1}. The key is still on the object: 'e' in result is true and result.e is undefined.
No. It always allocates a new object. Nested values are copied by reference, so the copy is shallow.
No. R.pickAll is a stable Ramda object helper from v0.1.0. It is not deprecated, experimental, or non-standard.