all repos — piggy @ d8748d219af2eb8f80b1589a04f72614d5638b86

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}