turtle: github.com/hackebrot/turtle Index | Examples | Files

package turtle

import "github.com/hackebrot/turtle"

Package turtle is a library for working with emojis. The API ca be used to retrieve emoji for a specific name, a category or a keyword. You can also search emojis if you do not know the name of an emoji.

Index

Examples

Package Files

doc.go emojis.go filters.go turtle.go

Constants

const Version = "v0.1.0"

Version of the turtle library

Variables

var Emojis = make(map[string]*Emoji)

Emojis maps a name to an Emoji

func Category Uses

func Category(c string) []*Emoji

Category filters the emojis by a category

Example for using the Category function to find all emojis of the specified category.

Code:

c := "travel_and_places"
emojis := Category(c)

if emojis == nil {
    fmt.Fprintf(os.Stderr, "no emojis found for category: %v\n", c)
    os.Exit(1)
}

fmt.Printf("%s: %s\n", c, emojis[:3])

Output:

travel_and_places: [🚡 ✈️ 🚑]

func Keyword Uses

func Keyword(k string) []*Emoji

Keyword filters the emojis by a keyword

Example for using the Keyword function to find all emojis with the specified keyword.

Code:

k := "happy"
emojis := Keyword(k)

if emojis == nil {
    fmt.Fprintf(os.Stderr, "no emoji found for keyword: %v\n", k)
    os.Exit(1)
}

fmt.Printf("%s: %s", k, emojis[:4])

Output:

happy: [😊 😁 😀 😂]
func Search(s string) []*Emoji

Search emojis by a name

type Emoji Uses

type Emoji struct {
    Name     string   `json:"name" toml:"name"`
    Category string   `json:"category" toml:"category"`
    Char     string   `json:"char" toml:"char"`
    Keywords []string `json:"keywords" toml:"keywords"`
}

Emoji holds info about an emoji character

func (Emoji) String Uses

func (e Emoji) String() string

String implementation for Emoji

Package turtle imports 1 packages (graph) and is imported by 2 packages. Updated 2017-10-12. Refresh now. Tools for package owners.