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

New API: visitor override? #19

Open
barneycarroll opened this issue Jun 3, 2018 · 1 comment
Open

New API: visitor override? #19

barneycarroll opened this issue Jun 3, 2018 · 1 comment

Comments

@barneycarroll
Copy link
Owner

I'm iterating over a recursive structure where it's undesirable for undefined values in the patch to replace their counterparts in the target.

According to the literal declarative nature of Patchinko this would be an intuitive scenario to create a new iteration token case for (I for ignore?) but in practice this is achievable with S by simply returning the input.

This proposal is for a function that can be supplied to P and run after patch iteration with the following arguments: key, source, patch, replace, replace being a function that can be invoked to replace the patch value.

Thus the generic 'skip nullish' scenario would read as:

O(a,b, ({source, patch, replace}) => (
  patch == null 
? 
  replace(source)
: 
  patch
)
@kristianmandrup
Copy link

Looks awesome! Why don't you make a PR with a test demonstrating it in practice and some docs :)

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