I didn't test my code at all and assumed we were doing a basic javascript styled pseudo-code thing here. My bad.
I assumed that basically what you just posted is what we had but we weren't showing the promise set up stuff, just the helper function. But yeah, the example you posted now is what I was going for more or less.
I think the nested ternary is super hard to read, and this is easier, though the use of the short-circuit like this is not a standard thing people do, I've found that people come to like it once they get used to it.
This all said, Typescript could remove the need for all the validation entirely.
Javascript pseudocode is fine, I kept asking because I didn't understand the intent of your code, not because it didn't work.
But yeah, the validations are not important, what I wanted to discuss is the construct in general, my particular case was just an example, so thanks for your input!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I didn't test my code at all and assumed we were doing a basic javascript styled pseudo-code thing here. My bad.
I assumed that basically what you just posted is what we had but we weren't showing the promise set up stuff, just the helper function. But yeah, the example you posted now is what I was going for more or less.
I think the nested ternary is super hard to read, and this is easier, though the use of the short-circuit like this is not a standard thing people do, I've found that people come to like it once they get used to it.
This all said, Typescript could remove the need for all the validation entirely.
Javascript pseudocode is fine, I kept asking because I didn't understand the intent of your code, not because it didn't work.
But yeah, the validations are not important, what I wanted to discuss is the construct in general, my particular case was just an example, so thanks for your input!