Skip to content

Commit

Permalink
Merge pull request #10 from mowshon/PrepareNewVersion
Browse files Browse the repository at this point in the history
Minor improvements
  • Loading branch information
mowshon authored Sep 14, 2023
2 parents 5c241c7 + 97e0c69 commit bbd6c20
Show file tree
Hide file tree
Showing 3 changed files with 234 additions and 251 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/mowshon/moviego

go 1.18
go 1.20

require (
github.com/tidwall/gjson v1.14.0
Expand Down
24 changes: 12 additions & 12 deletions helpers.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package moviego

type Ordered interface {
int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | uintptr | float32 | float64 | string
int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | uintptr | float32 | float64 | string
}

func InArray[T Ordered](needle T, haystack []T) bool {
for _, val := range haystack {
if val == needle {
return true
}
}
return false
for _, val := range haystack {
if val == needle {
return true
}
}
return false
}

func Keys[M ~map[K]V, K comparable, V any](m M) []K {
r := make([]K, 0, len(m))
for k := range m {
r = append(r, k)
}
return r
r := make([]K, 0, len(m))
for k := range m {
r = append(r, k)
}
return r
}
Loading

0 comments on commit bbd6c20

Please sign in to comment.