deepdash
deepdash copied to clipboard
omitDeep changes input on empty array
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
Hi, thank you for report, will check it soon