I couldn’t tell you if AI code assistants would write this, or catch it - ironically enough, “the perils of programming in plain text” is one of my stated reasons for eschewing AI assistance.
Given that the succinctness just bit me, I’m inclined to sacrifice it and go with
// over the range 0..23, +1 gives the same result%2 as -1, and also handles edge case of 0
const lastHour = new Date().getUTCHours() + 1
…
env.QUEUES[lastHour % 2]
Fundamentally I guess I was just objecting to doing arithmetic in the time domain to achieve negating a boolean.
I couldn’t tell you if AI code assistants would write this, or catch it - ironically enough, “the perils of programming in plain text” is one of my stated reasons for eschewing AI assistance.
Given that the succinctness just bit me, I’m inclined to sacrifice it and go with
Fundamentally I guess I was just objecting to doing arithmetic in the time domain to achieve negating a boolean.