-
Notifications
You must be signed in to change notification settings - Fork 11
/
turtle.go
37 lines (29 loc) 路 773 Bytes
/
turtle.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package turtle
// Version of the turtle library
const Version = "v0.2.0"
// Emojis maps a name to an Emoji
var Emojis = make(map[string]*Emoji)
// EmojisByChar maps a character to an Emoji
var EmojisByChar = make(map[string]*Emoji)
func init() {
for _, e := range emojis {
Emojis[e.Name] = e
EmojisByChar[e.Char] = e
}
}
// Search emojis by a name
func Search(s string) []*Emoji {
return search(emojis, s)
}
// Keyword filters the emojis by a keyword
func Keyword(k string) []*Emoji {
return keyword(emojis, k)
}
// Category filters the emojis by a category
func Category(c string) []*Emoji {
return category(emojis, c)
}
// Filter the emojis based on the given comparison function
func Filter(f func(e *Emoji) bool) []*Emoji {
return filter(emojis, f)
}