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

deepAssign does not support updating arrays using objects with numeric keys #308

Closed
4 tasks
RyanMilligan opened this issue Jan 19, 2018 · 4 comments
Closed
4 tasks

Comments

@RyanMilligan
Copy link

How often can you reproduce it?

  • [ x ] Always
  • Sometimes
  • Rarely
  • Unable
  • I didn’t try

Description: deepAssign() does not support updating specific items in arrays by passing objects with an index of, for example, 1. Instead, it ignores the keys in the source object and updates the first N items in the array.

  1. JSBin: https://jsbin.com/suyowov/edit?js,console,output
  2. Open the console and run the script
  3. The third object output should show that "second" has changed to 2, but instead the 1 from the previous output has changed to 2

Actual results: Only the first item in the array can be edited in this way

Environment:

Software Version
can-define version 1.5.4
Browser Chrome Update 63
Operating system Windows 10 # #
@RyanMilligan
Copy link
Author

RyanMilligan commented Jan 19, 2018

A proposed solution can be found here but I logged it here at the request of @phillipskevin.

@justinbmeyer
Copy link
Contributor

Issue moved to canjs/can-reflect #99 via ZenHub

@justinbmeyer
Copy link
Contributor

thanks for reporting, moving to can-reflect.

@justinbmeyer
Copy link
Contributor

I'm not sure the proposed solution is the right one. What should toArray({0: "a"}) return?

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

2 participants