https://github.com/popbones/goo
goo - Go goodies 😂
https://github.com/popbones/goo
Last synced: over 1 year ago
JSON representation
goo - Go goodies 😂
- Host: GitHub
- URL: https://github.com/popbones/goo
- Owner: popbones
- License: bsd-3-clause
- Created: 2022-07-21T04:37:57.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-23T01:27:38.000Z (almost 4 years ago)
- Last Synced: 2024-06-20T03:27:44.163Z (about 2 years ago)
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# goo
goo - Go goodies
A joke package that includes things that should be in the STD since generics.
Most of them are written by Copilot.
- `func Must[T any](v T, err error) T`
Returns `v` if `err` is `nil`, otherwise panic.
- `func Fallback[T comparable](v T, fallback T) T`
Returns `v` if `v` is not empty value for `T`, otherwise return `fallback`.
- `func MapSlice[E any, V any](s []E, f func(E) V) []V`
Map slice.
- `func ReduceSlice[E any, V any](s []E, initial V, f func(V, E) V) V`
Reduce slice.
- `func ParseNumber[T Number](s string) (T, error)`
Parse a number from string.
- `func Ptr[T any](v T) *T`
Returns pointer to value.