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

Array to Object not working as expected #65

Closed
alexandernanberg opened this issue Jun 29, 2017 · 1 comment · Fixed by #66
Closed

Array to Object not working as expected #65

alexandernanberg opened this issue Jun 29, 2017 · 1 comment · Fixed by #66

Comments

@alexandernanberg
Copy link

Having some problems with converting arrays to objects and discarding current array values.

const deepmerge = require('deepmerge');

const x = {
  prop: ['hello'],
}

const y = {
  prop: {
    name: 'foo',
    value: 'bar'
  }
}

const result = deepmerge(x, y);

result.prop 
// expected { name: 'foo', value: 'bar' } but resulted in { 0: 'hello', name: 'foo', value: 'bar' }  

Is it possible to achieve what I'm looking for?

@TehShrike
Copy link
Owner

I think you're right, this looks like a bug.

I'd be worried that somebody might be relying on this behavior, though - I would probably release it as a feature version bump at least.

Anyone have any thoughts?

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

Successfully merging a pull request may close this issue.

2 participants