Closed marcoalbarelli closed 7 years ago
I like the idea @marcoalbarelli , however seeing that JavaScript is very flexible you could end up doing this:
job.status = job.statuses.tttterminated
And now the job.statue
is undefined
.
I had this issue when I was using the sudo enums
object I made to centralize the strings and values used within. I made the odd typo here and there and undefined
got set to a property or status. It caused a bug and I found the issues, however it is not ideal.
I see no reason why you can't simply make a statuses object in your own code which contains a subset of the statuses available. By doing that you can read the available status values in your code.
I get your point I can easily live with that and some constants in my code, also I take it the states themselves are not changing anytime soon :)
I'm at a conference so I didn't have the time to check thoroughly, but it seems like there is no clean way to retrieve constants like for instance job statuses
Mi current scenario is to mark a job as terminated and I resorted to hardcoding something like this:
I would really like best to retrieve the
terminated
string from the library One possible way would be to expose it through the Job itself, this would turn into something likeAs usual if you think it's useful I'll be more than glad to provide a PR