I have a curried function that will return undefined when run on a server (SSR), but will return an analytics package when running on the client.
const isServer = typeof window !== 'undefined' getThing = () => isServer ? undefined : message => console.log(message)
When we access this function, we test for the existence of it, then curry events to it. The line currently reads something like this:
getThing() && getThing()('herpderp')
I find this deeply annoying. I would like to use an optional (or something like that) to evaluate for the existence of the package. Is something similar to this possible?
You just need to add a period after the