mirror of
https://github.com/emojisum/emojisum.git
synced 2025-01-24 03:40:07 +00:00
main: make the Map use the first colon notation
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
a9e159d830
commit
7fea20724b
2 changed files with 9 additions and 3 deletions
|
@ -25,10 +25,10 @@ type VersionedMap struct {
|
|||
}
|
||||
|
||||
// Words are a set of options to represent an emoji.
|
||||
// Possible options could be the ":colon_notion:" or a "U+26CF" style codepoint.
|
||||
// Possible options could be the ":colon_notation:" or a "U+26CF" style codepoint.
|
||||
type Words []string
|
||||
|
||||
// IsColonNotation checks for whether a word is the :colon_notion: of emoji
|
||||
// IsColonNotation checks for whether a word is the :colon_notation: of emoji
|
||||
func IsColonNotation(word string) bool {
|
||||
return strings.HasPrefix(word, ":") && strings.HasSuffix(word, ":")
|
||||
}
|
||||
|
|
8
main.go
8
main.go
|
@ -174,7 +174,13 @@ func Sum(r io.Reader) ([]byte, error) {
|
|||
func emojiFromBytes(buf []byte) string {
|
||||
var ret string
|
||||
for _, b := range buf {
|
||||
ret = ret + esum.Map(b)[0]
|
||||
for _, e := range esum.Map(b) {
|
||||
// use the first colon notation word and continue
|
||||
if esum.IsColonNotation(e) {
|
||||
ret = ret + e
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue