meander

Nikolas Pafitis 2022-03-12T21:03:36.126379Z

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

Jimmy Miller 2022-03-12T21:04:30.953359Z

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

Nikolas Pafitis 2022-03-12T21:07:59.877209Z

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

Jimmy Miller 2022-03-12T21:08:26.129759Z

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

Nikolas Pafitis 2022-03-12T21:08:59.814759Z

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 Miller 2022-03-12T21:10:47.753979Z

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 Pafitis 2022-03-12T21:14:24.751899Z

I see, thanks that works great!