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

customMerge on constructor #197

Open
xenoterracide opened this issue May 21, 2020 · 1 comment
Open

customMerge on constructor #197

xenoterracide opened this issue May 21, 2020 · 1 comment

Comments

@xenoterracide
Copy link

xenoterracide commented May 21, 2020

I want to merge a @js-joda/core type, these apparently can't be cloned simply by value... so I'm looking at customMerge, but I realize I'll more or less have to write it for every key... I mean, I can do some functional magic... What I'd really like to do, is have some kind of a check function that could work on the constructor, and then run the custom merge.

maybe something like

mergers:[ {
    should( key, x, y ): boolean,
    merge( x, y ): unknown
}]

this way the algorithm will just continue if should returns false

in this case all I really want is to return right if defined, and left if not, since these are immutable value objects no need to try to do a special copy.

@TehShrike
Copy link
Owner

This sounds like it overlaps with #184 and #176 – how do the solutions proposed in those threads sound to you?

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