all repos — piggy @ 46e32843c33c2a0a8c7cfb71a71b4456234057b0

Dead simple finance manager in Go, HTML and JS.

src/app/utils.go (view raw)

 1package app
 2
 3var ExchangeIDs []uint
 4
 5func IndexOf[T comparable](slice []T, element T) int {
 6	for i, el := range slice {
 7		if el == element {
 8			return i
 9		}
10	}
11	return -1
12}
13
14func Contains[T comparable](slice []T, element T) bool {
15	return IndexOf(slice, element) != -1
16}
17
18func IsExchange(bookmakerID uint) bool {
19	return Contains(ExchangeIDs, bookmakerID)
20}