github.com/bign8/ternary
Package ternary provides methods similar to other languages ternary operator Have you ever wanted those pesky ternary operators for java/c/javascript/everything else? You know, the special sauce that allows you to do this stuff. But then you came over to the go world and realized the shortest way to do this was 4 lines of code. Yeah, I had to go club some baby seals when I made that realization. But wait! I have crawled through the river of crappy code and propose this package to keep you clean on the other side. Now you you can use the following to assist with your ternary operator needs! Much better! Oh, but you say you want to use ternary operators with something other than strings? Well go ahead!!! We support most of the core types: See index below for more! Unfortunantly, I can't implement EVERY type. There are complicated ones like Array, Chan, Func, Map, Ptr, Slice and Struct that can take on any form. Thank goodness go has typecasting! If you run into something this packages doesn't support, just use the Interface comparison!
proxy.golang.org
v0.0.0-20250325144943-fd7a80faf15f
about 1 year ago
2
Links
| Registry | proxy.golang.org |
| Source | Repository |
| Docs | Documentation |
| JSON API | View JSON |
| CodeMeta | codemeta.json |
Package Details
| PURL |
pkg:golang/github.com/bign8/ternary
spec |
| License | Unlicense |
| Namespace | github.com/bign8 |
| First Release | over 3 years ago |
| Last Synced | 12 days ago |
Repository
| Stars | 1 on GitHub |
| Forks | 0 on GitHub |