So if you wrapped it into a function, it could look like this:
But there’s probably more ways to make it neater, more dev-friendly and less carpal tunnel inducing.