8000 When merging modified primitive type objects, added properties get dropped · Issue #2008 · lodash/lodash · GitHub
[go: up one dir, main page]

Skip to content 8000
When merging modified primitive type objects, added properties get dropped #2008
Closed
@codingmatty

Description

@codingmatty

Bug when using v4.4.0
We use a pattern where we add properties to a string object. When we try to merge that string property into another object, all the properties originally added are dropped.
I'm not sure if this is specifically an issue with merge, or if other functions are affected.

> var testStr = new String('testStr');
> testStr.prop1 = 'testStr.prop1'
> testStr
{ [String: 'testStr'] prop1: 'testStr.prop1' }

// It seems to work 1 level deep.
> _.merge({}, { testStr: testStr })
{ testStr: { [String: 'testStr'] prop1: 'testStr.prop1' } }

// but any deeper and it doesn't work as expected.
> _.merge({}, { testStr: { testStr: testStr } })
{ testStr: { testStr: [String: 'testStr'] } }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0