Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omitDeep changes input on empty array #111

Open
emahuni opened this issue Jun 17, 2021 · 1 comment
Open

omitDeep changes input on empty array #111

emahuni opened this issue Jun 17, 2021 · 1 comment

Comments

@emahuni
Copy link

emahuni commented Jun 17, 2021

There is an unexpected behavior with omitDeep, which I think is inherited throughout other parts of the lib as well.
If omitDeep is given an empty array, it changes the array to null, which it should have left as an empty array. See code examples below.

let a = [{ aa: 'aaa', bb: { cc: 'ccc'}}]

_.omitDeep(a, 'cc')
// ==> [ { aa: 'aaa', bb: {} } ]  ✅

_.omitDeep([ [] ], 'cc')
// ==> [ [] ] ✅
_.omitDeep([], 'cc')
// ==> null ❌  <----  it was supposed to return [] like empty object below

_.omitDeep([{}], 'cc')
// ==> [ {} ] ✅
_.omitDeep({}, 'cc')
// ==> {} ✅  <--- empty object example
@YuriGor
Copy link
Owner

YuriGor commented Jun 20, 2021

Hi, thank you for report, will check it soon

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

No branches or pull requests

2 participants