You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.
deep-assign try to set string characters to elements of the ['u'] array, and it throws TypeError: Cannot assign to read only property '0' of [object String].
You can test it on tonicdev
I was instead expecting to obtain as result { prop: ['u'] }. That is, I was expecting the whole target prop to be overwritten by the source prop, being it a string and not an object.
Is this by design? If not , I could write a PR to implement the expectation I explain.
The text was updated successfully, but these errors were encountered:
@parro-it In my opinion that is the expected behavior, because we recursively Object.assign():
assign({prop: 'test1'},{prop: ['u']});// should be similar to{prop: deep_assign('test1',['u'])}// which have to be the same as {prop: Object.assign('test1',['u'])}//=> TypeError: Cannot assign to read only property '0' of [object String]
I'm open for suggestions, but please read #13 (comment) first.
I close this issue, in favor of #13, please reopen if needed.
I have to assign an object to another that could have prop of different kind.
In this example:
deep-assign try to set string characters to elements of the
['u']
array, and it throwsTypeError: Cannot assign to read only property '0' of [object String]
.You can test it on tonicdev
I was instead expecting to obtain as result { prop: ['u'] }. That is, I was expecting the whole target
prop
to be overwritten by the sourceprop
, being it a string and not an object.Is this by design? If not , I could write a PR to implement the expectation I explain.
The text was updated successfully, but these errors were encountered: