Lodash _.omit() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Object

Definition

Creates an object composed of the enumerable property paths of object that are not omitted. Part of Lodash Object since 0.1.0 (stable — not deprecated).

Note: Returns a new object — the source is not mutated. Remaining nested values are still shared by reference (shallow copy of kept props).

Syntax

Call _.omit. Start with this line.

Lodash
_.omit(object, [paths])
CallWhat it does
_.omit(object, [paths])Primary signature.
_.omit(object)Work with an object’s keys, values, or paths.

Prefer import omit from "lodash/omit" when you want a smaller bundle.

Library declarations
Lodash
_.omit(object, [paths])

Parameters

This method has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*New object without those paths

Lodash Examples

Example 1 — Official: Omit a and c

Pass an array of top-level keys to remove.

Lodash
var object = { a: 1, b: '2', c: 3 };

_.omit(object, ['a', 'c']);
// → { b: '2' }
Try It Yourself

How It Works

  1. Clone. Start from enumerable props of object.
  2. Drop a. Remove key a.
  3. Drop c. Remove key c.
  4. Keep b. Only b: '2' remains.

Example 2 — Variadic Paths

Same result with separate string arguments.

Lodash
_.omit({ a: 1, b: '2', c: 3 }, 'a', 'c');
// → { b: '2' }
Try It Yourself

How It Works

  1. Rest args. 'a' and 'c' are paths.
  2. Same as array. Equivalent to ['a','c'].
  3. Result. Still { b: '2' }.
  4. Pick a style. Use whichever reads clearer in your code.

Example 3 — Nested Path

Omit a nested field with a path string.

Lodash
_.omit({ a: 1, b: { c: 2, d: 3 } }, 'b.c');
// → { a: 1, b: { d: 3 } }
Try It Yourself

How It Works

  1. Path. 'b.c' targets nested key c.
  2. Unset. Removes c under b.
  3. Keep. a and b.d remain.
  4. Use. Handy for stripping one nested secret field.

Example 4 — Missing Path

Omitting a path that does not exist is a no-op.

Lodash
_.omit({ a: 1 }, 'z');
// → { a: 1 }
Try It Yourself

How It Works

  1. No key z. Nothing to remove.
  2. Copy. Still returns a new object with a.
  3. Safe. No error for unknown paths.
  4. Idempotent. Safe to list optional fields.

Example 5 — omit vs pick

Opposite helpers: drop listed paths vs keep them.

Lodash
var object = { a: 1, b: '2', c: 3 };

_.omit(object, ['a', 'c']);
// → { b: '2' }

_.pick(object, ['a', 'c']);
// → { a: 1, c: 3 }
Try It Yourself

How It Works

  1. omit. Removes a and c → keeps b.
  2. pick. Keeps only a and c.
  3. Choose. Short denylist → omit; short allowlist → pick.
  4. Source. Unchanged in both cases.

Browser & Runtime Support

_.omit is a Lodash Object helper since 0.1.0. It runs anywhere Lodash runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install lodash.

✓ Stable · Lodash 0.1.0+

_.omit()

Available in [email protected] full builds and the lodash/omit modular import. Works in evergreen browsers and current Node LTS when Lodash is installed.

100% With Lodash 0.1+
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
_.omit Lodash 0.1.0+

Bottom line: Safe for production once Lodash is loaded. Prefer import omit from "lodash/omit" for smaller bundles. Use it to strip known paths without mutating the source.

Frequently Asked Questions

_.omit(object, …paths) returns a new object with all enumerable string keys from object except the listed paths. Official: _.omit({a:1,b:'2',c:3}, ['a','c']) → {b:'2'}.
No. It returns a new object. The source is left unchanged.
As an array (_.omit(obj, ['a','c'])) or as separate arguments (_.omit(obj, 'a', 'c')). Both forms work.
Yes. Pass a path string like 'b.c' or a path array. The parent object is copied with that nested key removed.
omit keeps everything except the listed paths. pick keeps only the listed paths.
Use import omit from "lodash/omit" or require("lodash/omit") for tree-shaking. Full build: import _ from "lodash" then _.omit.

Next: _.omitBy()

Omit properties whose values fail (or pass) a predicate.

_.omitBy() tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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.

10 people found this page helpful