Skip to content

Object.assign documentation and tests #115

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

Closed

Conversation

jmagaram
Copy link
Contributor

This took me a while because I wrote some tests to experiment and got the source and target mixed up - the mutable target goes first. Should we have labels on these?

I attempted to write code for assignMany but it doesn't work because you can't create an array of objects with different types. Well you can I guess if they start off as Object.empty() or are imported - jumping through hoops. Will this really get used? Do we need a toGenericObject function?

I couldnt' figure out the other flavor of assign with the json thing and what it does.

Copy link
Collaborator

@zth zth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great!

Good point about assignMany. I think we can leave it undocumented for now. The Object module is for more specialized usage anyway.

docs for assignMany but no examples.
@glennsl
Copy link
Contributor

glennsl commented Mar 21, 2023

Adding assign2, assign3 etc. could be a good idea.

@glennsl
Copy link
Contributor

glennsl commented Mar 21, 2023

But you can also just chain calls to assign, so... 🤷

@jmagaram
Copy link
Contributor Author

Interesting idea on the assign2 assign3 - hadn't thought about that. I don't know when any of these functions will get used from ReScript, if ever. I wouldn't mind removing the assignMany and rely on chaining calls. A toUntypedObject could normalize objects in a list so assignMany will work. You all have much more real-world experience and know better what is needed here.

@jmagaram
Copy link
Contributor Author

Consolidated into #117

@jmagaram jmagaram closed this Jul 12, 2023
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 this pull request may close these issues.

3 participants