2019-11-29 06:59:40 -05:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
|
// See LICENSE.txt for license information.
|
2019-10-29 23:17:04 -04:00
|
|
|
|
|
|
|
|
package plugin
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func stringify(objects []interface{}) []string {
|
2019-11-01 18:08:01 -04:00
|
|
|
stringified := make([]string, len(objects))
|
2019-10-29 23:17:04 -04:00
|
|
|
for i, object := range objects {
|
|
|
|
|
stringified[i] = fmt.Sprintf("%+v", object)
|
|
|
|
|
}
|
|
|
|
|
return stringified
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func toObjects(strings []string) []interface{} {
|
|
|
|
|
if strings == nil {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
objects := make([]interface{}, len(strings))
|
|
|
|
|
for i, string := range strings {
|
|
|
|
|
objects[i] = string
|
|
|
|
|
}
|
|
|
|
|
return objects
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func stringifyToObjects(objects []interface{}) []interface{} {
|
|
|
|
|
return toObjects(stringify(objects))
|
|
|
|
|
}
|