summaryrefslogtreecommitdiffstats
path: root/pkg/utils
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2019-11-04 11:46:28 +1100
committerJesse Duffield <jessedduffield@gmail.com>2019-11-05 19:22:01 +1100
commita3c84296bf2fbc8b132d5b2285eedba09813fbee (patch)
tree5c8e3cad92a43271eb677d44bca841710cdcc062 /pkg/utils
parentcc039d1f9b74dd246dc1eab389d67c592854def0 (diff)
use array of ints instead of range
Diffstat (limited to 'pkg/utils')
-rw-r--r--pkg/utils/utils.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go
index 42470df88..f184c0bbb 100644
--- a/pkg/utils/utils.go
+++ b/pkg/utils/utils.go
@@ -226,6 +226,16 @@ func IncludesString(list []string, a string) bool {
return false
}
+// IncludesInt if the list contains the Int
+func IncludesInt(list []int, a int) bool {
+ for _, b := range list {
+ if b == a {
+ return true
+ }
+ }
+ return false
+}
+
// NextIndex returns the index of the element that comes after the given number
func NextIndex(numbers []int, currentNumber int) int {
for index, number := range numbers {