Effect CommunityEC
Effect Communityβ€’2w agoβ€’
4 replies
combab0

Using Effect's Match for Cleaner Code

return diff <= -86400
    ? formatDate(timestamp)
    : diff <= -3600
      ? rtf.format(Math.floor(diff / 3600), 'hour')
      : diff <= -60
        ? rtf.format(Math.floor(diff / 60), 'minute')
        : rtf.format(Math.floor(diff), 'second')

I think effect's something make my code much more clean? any hint for me? I always use Match to get clean code for exact match cases.
Was this page helpful?