Ramda.js R.omit() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Object

Definition

Ramda’s R.omit() answers a shrinking question: give me a copy of this object without these keys. You pass an array of names, then the object. You get a new object. The original is never mutated. Nested values stay shared by reference. Native JavaScript’s cousin is rest syntax: const { a, d, ...rest } = obj. That is data-first and painful to reuse. omit is data-last, so R.omit(['password']) is already a function of one object — ready for R.map or R.pipe.

The official sample is the whole idea. R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}) is {b: 2, c: 3}. Need to keep a list instead of drop it? That is the docs sibling, R.pick. Need exactly one key gone? That is R.dissoc. Need a nested field gone? That is R.dissocPath. Lodash _.omit is close; Ramda wants a names array and a data-last object.

Syntax

Call R.omit. Start with this line.

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

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

Library declarations
Ramda
R.omit(names, obj)

Parameters

ParameterDescription
namesRequired. Array of String. Property names to leave off the copy. Missing names are ignored. An empty list copies every enumerable property.
objRequired. Object. The source. It is never mutated. A new plain object is returned.

Return Value

Return ValueDescription
ObjectA new object with the listed keys omitted. Nested values stay shared by reference. Enumerable properties from the prototype chain are copied unless their names are in the list.

Ramda Examples

📚 Getting Started

The official Ramda sample, then a real blacklist with curry and a name that is not on the object.

Example 1 — Official Omit

Two keys leave. Two keys stay. That is the docs sample from ramdajs.com.

Ramda
R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4});
//=> {b: 2, c: 3}
Try It Yourself

How It Works

Ramda copies every enumerable property except a and d. The leftover is a new object. That is the docs sample from ramdajs.com.

Example 2 — Strip Secrets, Curry, Missing Names

Fill the names list to get a function of one object. A name that is not present is ignored. The original record still holds the password.

Ramda
const orig = { user: 'Ada', password: 'secret', role: 'admin' };
const dropSecrets = R.omit(['password', 'token']);

dropSecrets(orig);
//=> {user: 'Ada', role: 'admin'}

orig;
//=> {user: 'Ada', password: 'secret', role: 'admin'}
Try It Yourself

How It Works

token is not on orig, so it does nothing. password is dropped on the copy only. Native rest would be const { password, token, ...rest } = orig — data-first, and you must name every key at the call site.

📈 Practical Patterns

Compare pick and dissoc, then prove the copy is shallow, then map a blacklist over many rows.

Example 3 — vs pick and dissoc

The same source, three leftovers. pick is the inverse. dissoc is one key. omit is a list.

Ramda
const obj = {a: 1, b: 2, c: 3, d: 4};

R.omit(['a', 'd'], obj);
//=> {b: 2, c: 3}

R.pick(['b', 'c'], obj);
//=> {b: 2, c: 3}

R.dissoc('a', obj);
//=> {b: 2, c: 3, d: 4}
Try It Yourself

How It Works

omit and pick agree here because the keys you drop are exactly the keys you do not keep. dissoc only removed a, so d remains. Prefer dissoc when the list would have one name.

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.

Ramda
const orig = { id: 1, secret: 'x', profile: { city: 'Paris' } };
const copy = R.omit(['secret'], orig);

copy;
//=> {id: 1, profile: {city: 'Paris'}}

copy === orig;
//=> false

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

How It Works

omit 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.dissoc.

Example 5 — Map, Empty List, Array Indexes

Fill the names and map over rows. An empty names list copies every enumerable property. Omitting an array index yields a plain object, not a shorter array.

Ramda
const dropPass = R.omit(['password']);

R.map(dropPass, [
  { user: 'Ada', password: 'a' },
  { user: 'Bo', password: 'b' }
]);
//=> [{user: 'Ada'}, {user: 'Bo'}]

R.omit([], {a: 1, b: 2});
//=> {a: 1, b: 2}

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

How It Works

Because omit is arity 2, filling names leaves a function of one object, ready for R.map. An empty list copies everything enumerable. The last call walks array indexes as object keys, so you get {'1': 'b', '2': 'c'}. Need a real array leftover? Use R.dissoc(0, list) instead.

Browser Support

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

Load Ramda 0.1.0 or later via CDN or npm, then call R.omit 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.omit() 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.omit(names, obj) returns a partial copy of obj without the keys listed in names. Added in v0.1.0. The original object is not mutated.
R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}) is {b: 2, c: 3}. Keys a and d are gone. b and c stay.
No. It always allocates a new object. Nested values are copied by reference, so the copy is shallow.
omit drops a list of keys. pick keeps a list of keys (the inverse). dissoc drops exactly one top-level key. dissocPath drops a nested path such as ['user', 'password'].
That name is ignored. You still get a copy of every remaining enumerable property. An empty names list copies every enumerable property.
No. R.omit is a stable Ramda object helper from v0.1.0. It is not deprecated, experimental, or non-standard.

Continue to R.over()

Learn how to apply a function through a lens using Ramda R.over().

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