Fork me on GitHub
Jeff Shelley22:11:44

Hi all, this threading macro has saved my life a couple times, yet I have no idea what it's doing: (-> % .-target .-value)

Jeff Shelley22:11:10

what do the .-target and .-value (presumably) functions do?


@js I am assuming you are using this within say an input's on-change event. The .- syntax is a way to access a property on a javascript object. So for the on-change, you can use .-target to get the thing in the dom that is firing the event (which would be an input), and then you can use .-value to access the value of that input (i.e., what you just typed in the input)

Jeff Shelley22:11:21

ah. so it's fetching the value of the event's target, not actually setting anything


yeah, that's just a getter

Jeff Shelley22:11:59

I see. I'd not known about .-

Jeff Shelley23:11:12

well awesome. thanks, I'll be able to sleep tonight, now!