maragudk / gomponents

HTML components in pure Go.
https://www.gomponents.com
MIT License
1.3k stars 32 forks source link

JS Ternary like #187

Closed TudorHulban closed 3 months ago

TudorHulban commented 3 months ago

hi, thank you for the nice library!

please advise if a javascript ternary like option exists in roadmap or could be implemented as

func Ternary(condition bool, n1, n2 Node) Node {
    if condition {
        return n1
    }

    return n2
}
markuswustenberg commented 3 months ago

Hi @TudorHulban , thank you for the issue!

Unfortunately I don't really want to increase the API surface area more than necessary, and I would consider something like this more a nice-to-have than need-to-have. I would suggest you maybe add it to a module you control and just use that. 😊