MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / LazyTernary

Function LazyTernary

utils/operator.go:56–61  ·  view source on GitHub ↗
(condition bool, trueFunc, falseFunc func() T)

Source from the content-addressed store, hash-verified

54}
55
56func LazyTernary[T any](condition bool, trueFunc, falseFunc func() T) T {
57 if condition {
58 return trueFunc()
59 }
60 return falseFunc()
61}
62
63func Map[T any, U any](list []T, mapper func(T) U) []U {
64 result := make([]U, len(list))

Callers 2

NewLocalFileFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected