Ramda.js R.dissoc() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Object

Definition

Ramda’s R.dissoc() answers a simple question: give me a copy of this object without that property. You pass the key, then the object. You get a new object. The original is never mutated. If the key is there, it is omitted. If it is missing, the clone still holds every original property.

The official sample is the whole idea. R.dissoc('b', {a: 1, b: 2, c: 3}) is {a: 1, c: 3}. Native JavaScript’s cousin is rest syntax: const { b, ...rest } = obj. That is data-first. dissoc is data-last, so R.dissoc('password') is already a function of one object — ready for R.map or R.pipe. Need to drop many keys? That is R.omit. Need a nested key? That is R.dissocPath. Need to put a key back? That is R.assoc. Lodash _.omit(obj, 'b') is data-first; Ramda clones and wants the key first.

Syntax

Call R.dissoc. Start with this line.

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

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

Library declarations
Ramda
R.dissoc(prop, obj)

Parameters

ParameterDescription
propOptional. String (or Int). The property name to omit. An integer key on an array removes that index on a new array.
objRequired. Object or Array. The source. It is never mutated. A new object (or array) is returned.

Return Value

Return ValueDescription
Object or ArrayA shallow clone without prop. Nested objects stay shared by reference. A missing key still yields a clone of the remaining properties.

Ramda Examples

📚 Getting Started

The official Ramda sample, then the same object so you can see the source is untouched and a missing key is safe.

Example 1 — Official Object

One key is omitted on a clone. The leftover is every original property except b.

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

How It Works

Ramda copies a and c onto a new object and skips b. The input literal is not reused as the return value. That is the docs sample from ramdajs.com.

Example 2 — No Mutation, Missing Key

The original object still holds b: 2. Dropping a name that is not there does not throw.

Ramda
const orig = {a: 1, b: 2, c: 3};

R.dissoc('b', orig);
//=> {a: 1, c: 3}

orig;
//=> {a: 1, b: 2, c: 3}

R.dissoc('z', orig);
//=> {a: 1, b: 2, c: 3}
Try It Yourself

How It Works

The clone is missing b. orig.b stays 2 because dissoc never uses delete on the source. A missing z is skipped during the copy, so you still get a new object with a, b, and c.

📈 Practical Patterns

omit and assoc, then a shallow nested copy versus dissocPath, then a curried helper and an array index.

Example 3 — vs omit and assoc

omit with one key matches dissoc. omit with two keys drops both. assoc is the inverse: putting b back restores the object.

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

R.dissoc('b', obj);
//=> {a: 1, c: 3}

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

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

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

How It Works

The docs point at omit for several keys and assoc for the opposite edit. Key order on the restored object can differ because assoc writes b last. Values match.

Example 4 — Shallow Copy vs dissocPath

Nested objects are shared by reference after dissoc. Nested deletes belong to dissocPath, which clones along the path.

Ramda
const orig = { user: { name: 'Ada' }, role: 'dev' };
const copy = R.dissoc('role', orig);

copy;
//=> { user: { name: 'Ada' } }

copy.user === orig.user;
//=> true

R.dissocPath(['user', 'name'], orig);
//=> { user: {}, role: 'dev' }

orig;
//=> { user: { name: 'Ada' }, role: 'dev' }
Try It Yourself

How It Works

dissoc copied the user pointer, then skipped role. Changing copy.user.name would also change orig.user.name. dissocPath clones the user object so name can disappear on a new tree. That is the next Object helper.

Example 5 — Curry, Map, Arrays

Fill the key to get a function of one object. Map it over rows. An integer key on an array removes that index on a new array.

Ramda
const dropB = R.dissoc('b');

dropB({a: 1, b: 2});
//=> {a: 1}

R.map(dropB, [{a: 1, b: 2}, {a: 3, b: 4}]);
//=> [{a: 1}, {a: 3}]

R.dissoc(1, ['a', 'b', 'c']);
//=> ['a', 'c']
Try It Yourself

How It Works

Because dissoc is arity 2, filling prop leaves a function of one object, ready for R.map and R.pipe. Integer keys on arrays go through the array branch: a new array with that index gone. A string '1' is a property name, not an index. For a slice of items, List R.remove is the named cousin.

Browser Support

R.dissoc() is ordinary JavaScript once Ramda is loaded. Logos use the shared browser-image-sprite.png sprite from this project.

✓ Ramda 0.10.0+ · Any JS runtime

Ramda.js R.dissoc()

Load Ramda 0.10.0 or later via CDN or npm, then call R.dissoc with a key and an object. No extra browser API is required.

100% With Ramda 0.10.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.dissoc() Universal

Bottom line: Safe in any project that includes Ramda 0.10.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.dissoc(prop, obj) returns a shallow clone of obj without prop. If the key is missing, the clone still has every original property. Added in v0.10.0. The original object is not mutated.
R.dissoc('b', {a: 1, b: 2, c: 3}) is {a: 1, c: 3}. Key b is gone. a and c stay.
No. It always returns a new object (or a new array when prop is an integer and obj is an array). Nested objects are copied by reference, so the clone is shallow.
dissoc drops one top-level key. omit drops a list of keys. assoc is the inverse: it sets a key on a clone. dissocPath drops a nested path such as ['user', 'name'].
You still get a clone. No error. The leftover looks like the original properties without that missing name.
No. R.dissoc is a stable Ramda object helper from v0.10.0. It is not deprecated, experimental, or non-standard.

Continue to R.dissocPath()

Learn how to drop a nested path on a cloned object using Ramda R.dissocPath().

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