Ramda.js R.pluck() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
List

Definition

R.pluck(key, list) returns a new list made of the same property taken from every item (official Ramda docs).

Stable since v0.1.0: R.pluck is not deprecated, experimental, or non-standard. It is shorthand for R.map(R.prop(key)).

Syntax

Call R.pluck. Start with this line.

Ramda
R.pluck(key, list)
CallWhat it does
R.pluck(key, list)Primary signature.
R.pluck(...)Call the list helper.

Prefer import { pluck } from "ramda" when you want a named import.

Library declarations
Ramda
R.pluck(key, list)

Parameters

ParameterDescription
keyRequired. String or number. Property name or array index to read
listRequired. Array (or any functor, e.g. an object). The items to read from; never changed

Return Value

Return ValueDescription
*The value returned by R.pluck().

Ramda Examples

Example 1 — Official getAges

Build a reusable getter, then pull every age out of a list of people.

Ramda
const getAges = R.pluck('age');

const people = [
  { name: 'fred', age: 29 },
  { name: 'wilma', age: 27 }
];

console.log(getAges(people)); // [29, 27]
Try It Yourself

How It Works

  1. Curried. R.pluck('age') has the key but no list yet, so it returns a function.
  2. Read. getAges(people) reads age from each object: 29, then 27.
  3. Collect. The values go into a new array in the same order → [29, 27].

Example 2 — Pluck by Array Index

When the items are arrays, the key is an index. This is also from the Ramda docs.

Ramda
const pairs = [[1, 2], [3, 4]];

console.log(R.pluck(0, pairs)); // [1, 3]
console.log(R.pluck(1, pairs)); // [2, 4]
Try It Yourself

How It Works

  1. Index 0. Takes the first element of each inner array: 1 from [1, 2], 3 from [3, 4].
  2. Index 1. Takes the second element: 2 and 4.
  3. Think columns. Plucking an index reads one “column” of a table of rows.

Example 3 — Pluck from an Object of Objects

R.pluck works on any functor. Give it an object and you get an object back.

Ramda
const scores = { a: { val: 3 }, b: { val: 5 } };

console.log(R.pluck('val', scores)); // { a: 3, b: 5 }
Try It Yourself

How It Works

  1. Functor. An object can be mapped over its values, so R.pluck accepts it.
  2. Per value. a: { val: 3 } → 3; b: { val: 5 } → 5.
  3. Same shape. The keys a and b stay, so the result is an object, not an array.

Example 4 — Total a Shopping Cart

Pluck the prices, then add them up with R.sum.

Ramda
const cart = [
  { item: 'pen', price: 5 },
  { item: 'book', price: 20 },
  { item: 'mug', price: 10 }
];

const total = R.pipe(R.pluck('price'), R.sum);

console.log(total(cart)); // 35
Try It Yourself

How It Works

  1. Pluck. R.pluck('price') turns the cart into [5, 20, 10].
  2. Sum. R.sum adds the numbers → 35.
  3. Pipeline. R.pipe joins both steps into one reusable total function.

Example 5 — Same as R.map(R.prop(key))

The Ramda docs describe pluck as this exact combination.

Ramda
const users = [{ name: 'Ada', age: 36 }, { name: 'Linus', age: 28 }];

console.log(R.pluck('name', users));           // ["Ada","Linus"]
console.log(R.map(R.prop('name'), users));     // ["Ada","Linus"]
Try It Yourself

How It Works

  1. pluck. Reads name from each user → ['Ada', 'Linus'].
  2. map + prop. R.prop('name') reads one name; R.map runs it on every user.
  3. Choose. Use pluck for a single property; use map when you need a custom formula.

Browser & Runtime Support

R.pluck() is plain JavaScript inside Ramda 0.1.0+. No special browser API is needed.

✓ Ramda 0.1.0+ · Any JS runtime

Ramda.js R.pluck()

The UMD build (ramda.min.js) is compiled to ES5 syntax, so it runs in Chrome, Firefox, Safari, and Edge, and in Node.js, Deno, and Bun.

100% With Ramda loaded
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
R.pluck() Universal

Bottom line: Safe in any project that includes Ramda (check with npm ls ramda). Load ramda.min.js from a CDN in the browser, or npm install ramda for Node, Deno, and Bun. These labs load [email protected].

Frequently Asked Questions

R.pluck(key, list) returns a new list with the value of key taken from every item. For objects the key is a property name; for arrays it is an index.
const getAges = R.pluck('age'); getAges([{ name: 'fred', age: 29 }, { name: 'wilma', age: 27 }]) returns [29, 27]. The docs also show R.pluck(0, [[1, 2], [3, 4]]) returning [1, 3].
Yes. The Ramda docs say pluck is equivalent to R.map(R.prop(k), f). Use pluck for readability when all you need is one property.
Those positions become undefined. The list keeps the same length. Remove them afterwards with R.reject(R.isNil) if needed.
No. R.pluck('address.city', list) looks for a key literally named 'address.city' and returns undefined. Use R.map(R.path(['address', 'city']), list) for nested values.
No. R.pluck has been part of Ramda since v0.1.0 and is stable. It is not deprecated, experimental, or non-standard.

Next: R.prepend()

Add one item to the front of a list without changing the original.

R.prepend() tutorial →

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