1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-12-02 15:47:47 +01:00
gojekyll/utils/string_set.go
2017-09-01 09:27:03 -04:00

21 lines
478 B
Go

package utils
// A StringSet is a set of strings, represented as a map.
type StringSet map[string]bool
// MakeStringSet creates a characteristic function map that tests for presence in an array.
func MakeStringSet(a []string) StringSet {
set := map[string]bool{}
for _, s := range a {
set[s] = true
}
return set
}
// AddStrings modifies the set to include the strings in an array.
func (ss StringSet) AddStrings(a []string) {
for _, s := range a {
ss[s] = true
}
}