1
0
Fork 0
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:
Vincent Batts 2025-04-01 12:43:43 -04:00
parent cbdb939f22
commit 548eaacf87
4 changed files with 157 additions and 126 deletions

21
cmd/emoji.go Normal file
View 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
}