Skip to content

Merge nested objects together #7

@OliverFischer

Description

@OliverFischer

Hi altogether, I have a simple question:

DataObjectParser.prototype.set overwrites property sections complete when adding properties to the resulting model. Is it possible to add a merge mechanism like $obj[$key] = _.merge($obj[$key]||{},$data); in line 35 in dataobject-parser.js? So nested properties can survive in the merge process like in this example:

dataobjParser.set('a',{projectId : 'common',route : 'a',fragment:{key : 'looser', anotherProp : 'I will survive'}})
dataobjParser.set('a', {projectId : 1, route : 'a',fragment:{key : 'winner'}})

I would like to see the the property 'anotherProp' from the first object even when overwriting the second one...

Greetings Olli

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions