all repos — piggy @ 693d77e1f7f4d3cc8f8da2e000d408ec3b1950ac

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}