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

feat: interceptor based transformers #122

Merged

Conversation

rschmukler
Copy link
Contributor

See the idea surfaced in #114.

This commit introduces interceptor based transformers by using the
:enter and :leave keys returned on the -value-transformer
function.

Naively it uses almost identical implementations for all enter and exit
applications, with the only exception being the collection-based
transformers which do look at the phase to avoid double wrapping
collections.

Ultimately there might be some occassions where we could speed things up
even more (eg. not reducing over a collection if there isn't a mapping
function anyway) but those optimizations don't exist in the current
implementation either, so this PR doesn't attempt to resolve any of
that.

See the idea surfaced in metosin#114.

This commit introduces interceptor based transformers by using the
`:enter` and `:leave` keys returned on the `-value-transformer`
function.

Naively it uses almost identical implementations for all enter and exit
applications, with the only exception being the collection-based
transformers which do look at the phase to avoid double wrapping
collections.

Ultimately there might be some occassions where we could speed things up
even more (eg. not reducing over a collection if there isn't a mapping
function anyway) but those optimizations don't exist in the current
implementation either, so this PR doesn't attempt to resolve any of
that.
@ikitommi
Copy link
Member

Looks good, I'll add some tests see if something is missing. Thanks!

@ikitommi ikitommi merged commit fdbca89 into metosin:master Nov 28, 2019
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.

2 participants