Fork me on GitHub
#meander
<
2022-03-12
>
Nikolas Pafitis21:03:36

Is there an option for meander to keep keys that are not specified in the pattern?

Jimmy Miller21:03:30

{:my-key ?my-key & ?rest}

Nikolas Pafitis21:03:59

then how would i use ?rest in the output expression?

Jimmy Miller21:03:26

Yes. (Sorry on my phone so hard to give a full example)

Nikolas Pafitis21:03:59

I did something like this and it works but is there a better way?

(meander/match props
    {:color-scheme ?color-scheme & ?rest}
    (merge {:color ?color-scheme}
           ?rest))

Jimmy Miller21:03:47

With match that works. With m/rewrite you could get rid of the merge and should be able to just write {:color ?color-scheme & ?rest } for the output.

Nikolas Pafitis21:03:24

I see, thanks that works great!