Skip to content

When merging modified primitive type objects, added properties get dropped #2008

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy