mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
785 B
785 B
name, slug, sourceRef, category, subCategory, signatures, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | variantHelpers | similarHelpers | position | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Empty | empty | type_manipulation.go#L132 | core | type |
|
|
|
120 |
Returns the zero value for the specified type. This is useful when you need an empty value of a specific type.
result := lo.Empty[string]()
// "" (zero value for string)
result = lo.Empty[int]()
// 0 (zero value for int)
result = lo.Empty[[]int]()
// []int{} (zero value for slice)
result = lo.Empty[map[string]int]()
// map[string]int{} (zero value for map)
result = lo.Empty[*int]()
// nil (zero value for pointer)