summaryrefslogtreecommitdiff
path: root/vendor/github.com/go-faker/faker/v4/pkg/slice/helpers.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-faker/faker/v4/pkg/slice/helpers.go')
-rw-r--r--vendor/github.com/go-faker/faker/v4/pkg/slice/helpers.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/vendor/github.com/go-faker/faker/v4/pkg/slice/helpers.go b/vendor/github.com/go-faker/faker/v4/pkg/slice/helpers.go
new file mode 100644
index 0000000..c85c74b
--- /dev/null
+++ b/vendor/github.com/go-faker/faker/v4/pkg/slice/helpers.go
@@ -0,0 +1,41 @@
+package slice
+
+import (
+ "strconv"
+)
+
+// Contains Check item in slice string type
+func Contains(slice []string, item string) bool {
+ for _, s := range slice {
+ if s == item {
+ return true
+ }
+ }
+ return false
+}
+
+// ContainsRune Check item in map rune type
+func ContainsRune(set map[rune]struct{}, item rune) bool {
+ _, ok := set[item]
+ return ok
+}
+
+// ContainsValue check if value exists in slice, no matter its type
+func ContainsValue(slice []interface{}, value interface{}) bool {
+ for _, v := range slice {
+ if v == value {
+ return true
+ }
+ }
+ return false
+}
+
+// IntToString Convert slice int to slice string
+func IntToString(intSl []int) (str []string) {
+ for i := range intSl {
+ number := intSl[i]
+ text := strconv.Itoa(number)
+ str = append(str, text)
+ }
+ return str
+}