summaryrefslogtreecommitdiffstats
path: root/utils/utils.go
diff options
context:
space:
mode:
authorDavid Lu <david.lu@hotmail.com>2016-05-27 08:35:55 -0700
committerCorey Hulen <corey@hulen.com>2016-05-27 08:35:55 -0700
commit0d0734ac9845ef32c55ebf4c3185ba85065c5940 (patch)
treeaaaf2522d8cacbf06fce4aee0d89aac1f1d9ec19 /utils/utils.go
parent1e7805b79025823fba4479ffaa354e9c756d6622 (diff)
downloadchat-0d0734ac9845ef32c55ebf4c3185ba85065c5940.tar.gz
chat-0d0734ac9845ef32c55ebf4c3185ba85065c5940.tar.bz2
chat-0d0734ac9845ef32c55ebf4c3185ba85065c5940.zip
Added duplicated trigger validation (#3124)
Diffstat (limited to 'utils/utils.go')
-rw-r--r--utils/utils.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/utils/utils.go b/utils/utils.go
new file mode 100644
index 000000000..f826c65a0
--- /dev/null
+++ b/utils/utils.go
@@ -0,0 +1,21 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package utils
+
+func StringArrayIntersection(arr1, arr2 []string) []string {
+ arrMap := map[string]bool{}
+ result := []string{}
+
+ for _, value := range arr1 {
+ arrMap[value] = true
+ }
+
+ for _, value := range arr2 {
+ if arrMap[value] {
+ result = append(result, value)
+ }
+ }
+
+ return result
+}