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)
Call
What 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
Parameter
Description
names
Required. Array of String. Property names to leave off the copy. Missing names are ignored. An empty list copies every enumerable property.
obj
Required. Object. The source. It is never mutated. A new plain object is returned.
Return Value
Return Value
Description
Object
A 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.
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.
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.
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.
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.
Compatibility
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 ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll 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.