Initial release
This commit is contained in:
commit
52b5c840f7
35
.editorconfig
Normal file
35
.editorconfig
Normal file
@ -0,0 +1,35 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
|
||||
end_of_line = LF
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.sh]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[{*.html,*.js,*.css,*.scss}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
||||
|
||||
[{{*.,}[Dd]ockerfile{.*,},{*.,}[Cc]ontainerfile{.*,}}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.proto]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[{*.go,go.mod}]
|
||||
indent_style = tab
|
||||
indent_size = 8
|
10
coalesce.go
Normal file
10
coalesce.go
Normal file
@ -0,0 +1,10 @@
|
||||
package defaults
|
||||
|
||||
func Coalesce[T comparable](variables ...T) (result T) {
|
||||
for _, v := range variables {
|
||||
if !Empty(v) {
|
||||
return v
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
6
defaults.go
Normal file
6
defaults.go
Normal file
@ -0,0 +1,6 @@
|
||||
package defaults
|
||||
|
||||
func Empty[T comparable](val T) bool {
|
||||
var empty T
|
||||
return val == empty
|
||||
}
|
Loading…
Reference in New Issue
Block a user