func IsZero
IsZero returns true if the value represents a "zero" or "empty" state for its type. For example:
- Numbers: 0
- Strings: ""
- Slices/Maps: empty
- nil: true
- bool: false
- time.Time: IsZero()
- address: empty string
Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.
Package typeutil provides utility functions for converting between different types and checking their states. It aims...
gno.land/p/moul/typeutil/v0Type conversion utilities.
Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.
⚠️ Disclaimer: provided as-is, without warranty; not security-audited. Full disclaimer: DISCLAIMER.
Package typeutil provides utility functions for converting between different types and checking their states. It aims to provide consistent behavior across different types while remaining lightweight and dependency-free.
IsZero returns true if the value represents a "zero" or "empty" state for its type. For example:
ToBool converts any value to a boolean based on common programming conventions. For example:
ToInterfaceSlice converts various slice types to []any
ToMapIntInterface converts a map with int keys and any value type to map[int]any
ToMapStringInterface converts a map with string keys and any value type to map[string]any
ToString converts any value to its string representation. It supports a wide range of Go types including:
Example usage:
ToStringSlice converts various slice types to []string