Ramda.js R.props() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Object

Definition

Ramda’s R.props() answers a packing question: give me these keys, as a list of values, in this order. You pass an array of names, then the object. You get an array. The original is never mutated. Native JavaScript’s cousin is [obj.x, obj.y]. That is data-first. props is data-last, so R.props(['first', 'last']) is already a function of one object — ready for R.map, R.pipe, or R.compose.

The official sample is the whole idea. R.props(['x', 'y'], {x: 1, y: 2}) is [1, 2]. A missing name is not skipped: R.props(['c', 'a', 'b'], {b: 2, a: 1}) is [undefined, 1, 2]. Need one key? That is R.prop. Need a new object of those keys? That is R.pick. Need one key off many objects? That is R.pluck. Need nested trails? That is R.paths.

Syntax

Call R.props. Start with this line.

Ramda
R.props(ps, obj)
CallWhat it does
R.props(ps, obj)Primary signature.
R.props(...)Call the object helper.

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

Library declarations
Ramda
R.props(ps, obj)

Parameters

ParameterDescription
psRequired. Array. Property names to fetch. Order is kept. Integers work as array indexes through R.prop / nth. An empty list returns [].
objRequired. Object or Array. The source. It is never mutated. null and undefined yield undefined in each slot.

Return Value

Return ValueDescription
ArrayOne leftover per name, in the same order as ps. A missing key is undefined in that slot. Duplicate names duplicate the leftover.

Ramda Examples

📚 Getting Started

The official leftover arrays, then the official compose sample that joins a full name.

Example 1 — Official Ordered Values

Present keys come out in name order. A missing name is a hole, not a skip.

Ramda
R.props(['x', 'y'], {x: 1, y: 2});
//=> [1, 2]

R.props(['c', 'a', 'b'], {b: 2, a: 1});
//=> [undefined, 1, 2]
Try It Yourself

How It Works

Each name is passed to R.prop. The leftover list follows ['c', 'a', 'b'], not the object’s own key order. c is missing, so slot 0 is undefined. That is the docs sample from ramdajs.com.

Example 2 — Official Full Name with Compose

Fill the names, then join the leftovers. Extra keys such as age are ignored.

Ramda
const fullName = R.compose(R.join(' '), R.props(['first', 'last']));

fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'});
//=> 'Tony Bullet-Tooth'
Try It Yourself

How It Works

compose runs right to left: props packs ['Tony', 'Bullet-Tooth'], then join glues them with a space. The leftover order is the names array, so first comes before last even though the object listed last first. Also from ramdajs.com.

📈 Practical Patterns

Compare cousins, then a curried helper mapped over rows, then holes, indexes, and a null object.

Example 3 — vs prop, pick, and pluck

prop is one leftover. pick is an object. pluck is one key off many objects.

Ramda
const obj = {x: 1, y: 2};

R.prop('x', obj);
//=> 1

R.props(['x', 'y'], obj);
//=> [1, 2]

R.pick(['x', 'y'], obj);
//=> {x: 1, y: 2}

R.pluck('x', [obj, {x: 9}]);
//=> [1, 9]
Try It Yourself

How It Works

props is many keys on one object. pluck is one key on many objects. pick keeps names as keys. Nested trails still belong on R.paths.

Example 4 — Curry and Map

Fill the names to map over rows. Each leftover is a two-slot list.

Ramda
const pair = R.props(['id', 'name']);

R.map(pair, [
  { id: 1, name: 'Ada', extra: true },
  { id: 2, name: 'Bo' }
]);
//=> [[1, 'Ada'], [2, 'Bo']]
Try It Yourself

How It Works

Because props is arity 2, filling the names leaves a function of one object. Extra keys such as extra never appear in the leftover. That list is ready for a table row or a CSV line.

Example 5 — Empty List, Duplicates, Indexes, Null

An empty names list is []. Repeating a name repeats the leftover. Integers index arrays. A null object does not throw.

Ramda
R.props([], {x: 1});
//=> []

R.props(['x', 'x'], {x: 1});
//=> [1, 1]

R.props([0, 2], ['a', 'b', 'c']);
//=> ['a', 'c']

R.props(['name'], null);
//=> [undefined]
Try It Yourself

How It Works

There is nothing to map when ps is empty. Duplicates are honest: two lookups, two leftovers. Index keys go through nth the same way as R.prop. Native null.name throws; R.prop on null is undefined, so the slot is a hole.

Browser Support

R.props() 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.props()

Load Ramda 0.1.0 or later via CDN or npm, then call R.props with a names array and an object. No extra browser API is required.

100% With Ramda 0.1.0+
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
R.props() 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.props(ps, obj) reads each listed key with R.prop and returns an array of values in that same order. A missing key is undefined in that slot. Added in v0.1.0. The original object is not mutated.
R.props(['x', 'y'], {x: 1, y: 2}) is [1, 2]. R.props(['c', 'a', 'b'], {b: 2, a: 1}) is [undefined, 1, 2]. R.compose(R.join(' '), R.props(['first', 'last']))({last: 'Bullet-Tooth', age: 33, first: 'Tony'}) is 'Tony Bullet-Tooth'.
prop reads one key. pick returns a new object of keys. pluck maps one key over a list of objects. paths walks nested trails. props is several top-level keys on one object, leftover array.
No. That slot is undefined. Native obj.missing is also undefined. A null object yields undefined in each slot instead of throwing.
Yes. The leftover array follows the names array, not the object's own key order.
No. R.props is a stable Ramda object helper from v0.1.0. It is not deprecated, experimental, or non-standard.

Continue to R.renameKeys()

Learn how to rename listed own keys with a mapping object using Ramda R.renameKeys().

R.renameKeys() 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