Skip to content

feat (object/omit-deep): add 'omitDeep' function to omit fields deeply#1841

Open
kevaldonga wants to merge 2 commits into
toss:mainfrom
kevaldonga:feat/omit-deep
Open

feat (object/omit-deep): add 'omitDeep' function to omit fields deeply#1841
kevaldonga wants to merge 2 commits into
toss:mainfrom
kevaldonga:feat/omit-deep

Conversation

@kevaldonga

Copy link
Copy Markdown

Summary

  • Add omitDeep function that removes deeply nested object fields using dot-separated paths (e.g. 'user.profile.email')
  • Supports top-level keys, nested objects, and field omission across array items
  • Strong TypeScript inference via Paths<T> for valid paths and OmitDeep<T, P> for the return type
  • 17 test cases including nested objects, arrays, entire field omission, primitives, and type checks
  • Docs in all 4 languages (en, ko, ja, zh_hans)

Test Plan

  • Top-level property omission
  • Nested path omission ('b.x', 'user.profile.email')
  • Multiple paths at once
  • Entire nested object omitted ('user.profile', 'b')
  • Property omitted from objects inside arrays ('users.secret')
  • Entire array field omitted ('users')
  • Nested arrays ('items.y')
  • Empty paths, all keys omitted, original object not mutated
  • Empty objects/arrays and non-existent nested paths (runtime no-op, type error)
  • Primitives (null, undefined, numbers, strings, booleans) unchanged
  • Type tests with expectTypeOf().toExtend()
  • yarn vitest run src/object/omitDeep --typecheck passes (17 tests, no type errors)

@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
es-toolkit Ready Ready Preview, Comment Jul 5, 2026 10:23am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant