Ramda.js R.project() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Object

Definition

Ramda’s R.project() answers a table question: keep these columns on every row. You pass a list of property names, then a list of objects. You get a new array of new objects. Native JavaScript is usually rows.map((row) => Object.fromEntries(names.map((k) => [k, row[k]]))). project is data-last, so R.project(['name', 'grade']) is already a function of one table — ready for R.pipe.

The official sample is the whole idea. Abby has name, age, hair, and grade. Fred has the same shape. R.project(['name', 'grade'], kids) is [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}]. That is a SQL SELECT name, grade FROM kids. Need one object? That is R.pick. Need holes for missing names? That is already baked in: project is R.map of R.pickAll. Need a column of values? That is R.pluck.

Syntax

Call R.project. Start with this line.

Ramda
R.project(names, list)
CallWhat it does
R.project(names, list)Primary signature.
R.project(...)Call the object helper.

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

Library declarations
Ramda
R.project(names, list)

Parameters

ParameterDescription
names (docs: props)Required. Array. The property names to keep on every row. Order in the leftover follows this list.
list (docs: objs)Required. Array. The objects to query. Each row is copied; the source array and objects are never mutated.

Return Value

Return ValueDescription
ArrayA new array of new objects, each with just the listed keys. Missing names are still present as undefined because the implementation maps R.pickAll. An empty list yields []. An empty names list yields an empty object per row.

Ramda Examples

📚 Getting Started

The official kids table, then what happens when a listed column is missing.

Example 1 — Official Kids Columns

Keep name and grade on every row. age and hair leave.

Ramda
const abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2};
const fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7};
const kids = [abby, fred];

R.project(['name', 'grade'], kids);
//=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}]
Try It Yourself

How It Works

That is the docs sample from ramdajs.com: a reasonable analog to SELECT name, grade. Each leftover is a new object. Abby and Fred are unchanged.

Example 2 — Missing Keys Stay as Holes

project maps pickAll, so a missing name is still on the leftover as undefined. JSON.stringify drops it.

Ramda
const kids = [
  {name: 'Abby', age: 7, hair: 'blond', grade: 2},
  {name: 'Fred', age: 12, hair: 'brown', grade: 7}
];
const rows = R.project(['name', 'pet'], kids);

rows[0].pet;
//=> undefined

'pet' in rows[0];
//=> true

JSON.stringify(rows);
Try It Yourself

How It Works

Use R.map(R.pick(['name', 'pet']), kids) if a missing column must disappear instead of sitting as undefined.

📈 Practical Patterns

Compare cousins, then a curried column set, then empty names and empty lists.

Example 3 — vs pick, pluck, and props

project returns objects. pluck returns values. props reads one row into an array.

Ramda
const abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2};
const fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7};
const kids = [abby, fred];

R.project(['name', 'grade'], kids);
//=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}]

R.map(R.pick(['name', 'grade']), kids);
//=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}]

R.pluck('name', kids);
//=> ['Abby', 'Fred']

R.props(['name', 'grade'], abby);
//=> ['Abby', 2]
Try It Yourself

How It Works

When every listed key exists, map + pick matches project. The difference appears on missing names: pick skips them; project keeps undefined.

Example 4 — Curry and Shallow Copy

Fill the names list to get a function of one table. Nested objects stay the same reference. The original rows stay fat.

Ramda
const orig = [
  { id: 7, name: 'Ada', profile: { city: 'Paris' } },
  { id: 8, name: 'Bo', profile: { city: 'Oslo' } }
];
const slim = R.project(['name', 'profile']);
const copy = slim(orig);

copy;
//=> [{name: 'Ada', profile: {city: 'Paris'}}, {name: 'Bo', profile: {city: 'Oslo'}}]

copy === orig;
//=> false

copy[0] === orig[0];
//=> false

copy[0].profile === orig[0].profile;
//=> true
Try It Yourself

How It Works

Because project is arity 2, filling names leaves a function of one list. Nested profile is copied by reference. Clone it (or use R.clone) if later writes must not leak.

Example 5 — Empty Names, Empty List, One Column

No columns yields {} per row. No rows yields []. One name still returns objects, not a pluck array.

Ramda
const kids = [
  {name: 'Abby', age: 7, hair: 'blond', grade: 2},
  {name: 'Fred', age: 12, hair: 'brown', grade: 7}
];

R.project([], kids);
//=> [{}, {}]

R.project(['name'], []);
//=> []

R.project(['age'], kids);
//=> [{age: 7}, {age: 12}]
Try It Yourself

How It Works

pickAll([], row) is {}, so two empty objects come back. Need [7, 12] instead of [{age: 7}, {age: 12}]? That is R.pluck('age', kids).

Browser Support

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

Load Ramda 0.1.0 or later via CDN or npm, then call R.project with a names list and an array of objects. 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.project() 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.project(names, list) maps R.pickAll(names) over a list of objects. Each leftover is a new object with only the listed keys. Added in v0.1.0. The original rows are not mutated. Ramda calls it a reasonable analog to SQL SELECT.
With kids Abby and Fred, R.project(['name', 'grade'], kids) is [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}]. age and hair are dropped on every row.
pick works on one object. project is pickAll mapped over a list. pluck returns an array of one property's values. props returns an array of values from one object. project always returns an array of objects.
project uses pickAll, so missing names still appear as undefined. JSON.stringify drops those keys. Use pick mapped over the list if you want missing names omitted.
No. Each leftover is a new object. Nested values are copied by reference, so the copy is shallow.
No. R.project is a stable Ramda object helper from v0.1.0. It is not deprecated, experimental, or non-standard.

Continue to R.prop()

Learn how to read one named property from an object using Ramda R.prop().

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