Skip to content

defaultsDeep with different results for undefined properties #2676

@rplopes

Description

@rplopes

Using defaultsDeep, undefined properties get filtered out when they're in the root level of the object, but not when they're nested. If defaultsDeep is meant to act recursively, shouldn't its rules be the same regardless of the nesting level?

To reproduce this issue:

> _.defaultsDeep({}, { foo: undefined })
{}

> _.defaultsDeep({}, { bar: { foo: undefined } })
{ bar: { foo: undefined } }  // by the same rules, shouldn't it be `{ bar: {} }` ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions