From 0d0734ac9845ef32c55ebf4c3185ba85065c5940 Mon Sep 17 00:00:00 2001 From: David Lu Date: Fri, 27 May 2016 08:35:55 -0700 Subject: Added duplicated trigger validation (#3124) --- utils/utils.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 utils/utils.go (limited to 'utils/utils.go') 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 +} -- cgit v1.2.3-1-g7c22