loader

package
v0.0.0-...-1fca3aa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlipPersonGender

func FlipPersonGender(r rune) rune

FlipPersonGender gives either 0x1f468 or 0x1f469, based on which other one was passed.

func RandomPersonGender

func RandomPersonGender() rune

RandomPersonGender returns either 0x1f468 or 0x1f469.

func ToPath

func ToPath(s string) string

ToPath converts a name into a lowercase path with dashes.

Types

type Data

type Data struct {
	LinkData
	Alts []string
	All  []LinkData
	// contains filtered or unexported fields
}

func (*Data) Filter

func (d *Data) Filter(t string) []LinkData

Filter filters the LinkData of this Data to the specified type.

func (Data) Has

func (d Data) Has(other string) bool

func (Data) Images

func (d Data) Images() []LinkData

Images returns the LinkData of this Data representing images.

type EmojiFormat

type EmojiFormat struct {
	Groups []interface{} `json:"groups"`
	Emoji  []interface{} `json:"all"`
}

EmojiFormat is returned via the .format call.

type Key

type Key string

func (Key) HasType

func (k Key) HasType() bool

func (Key) Split

func (k Key) Split() (t, title string)

func (Key) String

func (k Key) String() string

func (Key) Type

func (k Key) Type() string

type LinkData

type LinkData struct {
	Title Key
	Emoji string
}

LinkData contains a ref to another Data, including the emoji for rendering.

func (LinkData) ImageCode

func (ld LinkData) ImageCode() string

func (LinkData) IsEmoji

func (ld LinkData) IsEmoji() bool

IsEmoji returns whether this is for a single Emoji.

func (LinkData) IsValid

func (ld LinkData) IsValid() bool

IsValid returns whether this info is valid to display, or whether it is special.

func (LinkData) RenderEmoji

func (ld LinkData) RenderEmoji() string

RenderEmoji renders either the single emoji, or a random arrangement of profession emoji.

func (LinkData) RenderSingleEmoji

func (ld LinkData) RenderSingleEmoji() string

RenderSingleEmoji renders either the single emoji, or a randomly gendered profession emoji.

func (LinkData) String

func (ld LinkData) String() string

String stringifies this Data, returning a title plus optional emoji.

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

Loader contains data about emoji.

func New

func New(lc LoaderConfig) *Loader

New builds a new *Loader.

func (*Loader) Format

func (l *Loader) Format() *EmojiFormat

func (*Loader) Groups

func (l *Loader) Groups() []LinkData

func (*Loader) Lookup

func (l *Loader) Lookup(cand string) (redir string, data *Data)

Lookup finds the EmojiData for the given candidate, or a redirect to said candidate.

func (*Loader) Random

func (l *Loader) Random(count int) []Data

func (*Loader) Search

func (l *Loader) Search(query string, count int) []Data

Seach is a lazy, non-indexed search that matches the current JS version.

type LoaderConfig

type LoaderConfig struct {
	Data   *emoji.Data
	Test   *emoji.Test
	Images *emoji.Cats
}

LoaderConfig is a config for building a Loader.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL