Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge.recursive doesn't seem to modify non-object properties #18

Open
mikealeonetti opened this issue Oct 9, 2015 · 0 comments
Open

Comments

@mikealeonetti
Copy link

Please consider the following code:

var a = { "debug" : true, "hagemashi" : "yasashii", "okuritai" : {
        "koto" : "ichi",
        "mono" : "ni"
    }
};
console.log( a );
var b = { "debug" : false, "hagemashi" : "yasashikunai", "okuritai" : {
        "koto" : "san",
        "mono" : "shi"
    }
};
console.log( merge.recursive( false, a, b ) );

console.log( a );

Outputs

{ debug: true,
  hagemashi: 'yasashii',
  okuritai: { koto: 'ichi', mono: 'ni' } }
{ debug: false,
  hagemashi: 'yasashikunai',
  okuritai: { koto: 'san', mono: 'shi' } }
{ debug: true,
  hagemashi: 'yasashii',
  okuritai: { koto: 'san', mono: 'shi' } }

I was assuming the last two outputs would be identical since the intention is to modify the original object. Am I using it incorrectly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant