mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
729 B
729 B
name, slug, sourceRef, category, subCategory, signatures, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | variantHelpers | similarHelpers | position | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| IsNotNil | isnil | type_manipulation.go#L22 | core | type |
|
|
|
87 |
Returns true if the input is not nil and does not point to a nil value. This works with pointers, interfaces, maps, slices, channels, and functions.
result := lo.IsNotNil(nil)
// false
var ptr *int
result = lo.IsNotNil(ptr)
// false
result = lo.IsNotNil(42)
// true
result = lo.IsNotNil("hello")
// true
var iface interface{}
result = lo.IsNotNil(iface)
// false
iface = 42
result = lo.IsNotNil(iface)
// true