Problem, as an interviewer would state it:
"Implement omit(obj, paths) — building a genuinely NEW object with every property EXCEPT the specified paths (both shallow keys and nested dot-paths) removed, matching lodash's own well-known _.omit behavior extended to support nested paths."
Examples:
omit({a:1, b:2, c:{d:3, e:4}}, ["b", "c.e"]); // {a:1, c:{d:3}}
Clarifying questions expected:
- Does this need to support removing a NESTED field specifically (leaving its sibling fields intact), not just entire top-level keys?
- Should the original object remain completely untouched, including its nested sub-objects?
- What is the real, correct behavior if a specified path does not actually exist in the object at all?
Code / implementation expected: Yes — real, direct proof of correct shallow-key removal, correct nested-field removal (with sibling fields preserved), and confirmation the original object is never mutated.