MCPcopy Create free account
hub / github.com/cli/cli / SomeIfNonZero

Function SomeIfNonZero

pkg/option/option.go:49–56  ·  view source on GitHub ↗
(value T)

Source from the content-addressed store, hash-verified

47}
48
49func SomeIfNonZero[T comparable](value T) Option[T] {
50 // value is a zero value then return a None
51 var zero T
52 if value == zero {
53 return None[T]()
54 }
55 return Some(value)
56}
57
58// String implements the [fmt.Stringer] interface.
59func (o Option[T]) String() string {

Callers

nothing calls this directly

Calls 1

SomeFunction · 0.85

Tested by

no test coverage detected