Documentation ¶
Index ¶
- func CopyMap[T any](m map[string]T) (result map[string]T)
- func If[T any](b bool, trueVal, falseVal T) T
- func IsDateString(date string) bool
- func LaunchBrowser(url string) error
- func MergeMap[T any](dst map[string]T, maps ...map[string]T)
- func NormalizeNewlines(s string) (result string)
- func ParseDateOrOffset(date string, fromDate string) (string, error)
- func ParseDateString(text string, loc *time.Location) (time.Time, error)
- func SortedMapKeys[K constraints.Ordered, V any](m map[K]V) (res []K)
- func TimeNowString() string
- func TodaysDate() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDateString ¶
IsDateString returns true if the `data` is formatted like YYYY-MM-DD.
func LaunchBrowser ¶
LaunchBrowser launches the browser at the url address. Waits till launch completed. Credit: https://stackoverflow.com/a/39324149/1136455
func NormalizeNewlines ¶
NormalizeNewlines converts \r\n (Window) and \n (Mac OS) line terminations to \n (UNIX) termination.
func ParseDateOrOffset ¶ added in v0.2.0
ParseDateOrOffset attempts to parse the `date` string which can be a YYYY-MM-DD formatted date or an integer offset (0=today, -1=yesterday, ...). The `fromDate` is a YYYY-MM-DD date string representing the date offset origin.
func ParseDateString ¶
ParseDateString parses converts a date string to a time.Time. If timezone is not specified Local is assumed.
func SortedMapKeys ¶
func SortedMapKeys[K constraints.Ordered, V any](m map[K]V) (res []K)
SortedMapKeys returns a sorted array of map keys. TODO tests
func TimeNowString ¶
func TimeNowString() string
TimeNowString returns the current time as a string.
Types ¶
This section is empty.