mirror of
https://github.com/emojisum/emojisum.git
synced 2025-07-29 11:20:28 +00:00
main: refactor a bit to get logic out of main and into ./cmd/
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
cbdb939f22
commit
548eaacf87
4 changed files with 157 additions and 126 deletions
21
cmd/emoji.go
Normal file
21
cmd/emoji.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
esum "github.com/emojisum/emojisum/emoji"
|
||||
)
|
||||
|
||||
// EmojiFromBytes parses the bytes buffer for colon notation and returns the
|
||||
// corresponding emoji
|
||||
func EmojiFromBytes(buf []byte) string {
|
||||
var ret string
|
||||
for _, b := range buf {
|
||||
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…
Add table
Add a link
Reference in a new issue