Documentation ¶
Index ¶
- type CharFormatter
- type CharFormatterDelegatingFormatter
- type CryptoRand
- type FastFingerCharFormatter
- type FatFingerCharFormatter
- type Formatter
- func DelimiterFormatterWith(repl string) Formatter
- func L337Formatter() Formatter
- func NewFastFingerFormatter() Formatter
- func NewFatFingerFormatter() Formatter
- func NewHorseFormatter() Formatter
- func NewLowercaseFormatter() Formatter
- func NewRandomlyFormatter(wrap Formatter) Formatter
- func NewSarcasticFormatter() Formatter
- func NewShuffleFormatter() Formatter
- func NewStudderFormatter() Formatter
- func NewSwearFormatter() Formatter
- func NewUppercaseFormatter() Formatter
- func NewWordReversingFormatter() Formatter
- func RandomTitleFormatter() Formatter
- func Uber1337Formatter() Formatter
- type HorseFormatter
- type L337CharFormatter
- type LowercaseCharFormatter
- type MultiFormatter
- type PerWordFormattingFormatter
- type RandomDevice
- type RandomlyFormattingCharFormatter
- type RandomlyFormattingFormatter
- type RegexReplacingFormatter
- type ReversingFormatter
- type ShuffleFormatter
- type StudderFormatter
- type SwitchCaseCharFormatter
- type TitleFormatter
- type UnitFormatter
- type UppercaseCharFormatter
- type WrappingCharFormatter
- type WrappingFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CharFormatter ¶
CharFormatter is a formatter that emits a slice of runes given a single rune.
type CharFormatterDelegatingFormatter ¶
type CharFormatterDelegatingFormatter struct {
CharFormatter
}
CharFormatterDelegatingFormatter is a Formatter that delegates each letter in the input to a CharFormatter
func (*CharFormatterDelegatingFormatter) Format ¶
func (c *CharFormatterDelegatingFormatter) Format(word string) string
Format calls the wrapped CharFormatter's FormatRune-method
func (*CharFormatterDelegatingFormatter) GetCharFormatter ¶ added in v0.6.1
func (c *CharFormatterDelegatingFormatter) GetCharFormatter() CharFormatter
GetCharFormatter returns the wrapped CharFormatter, which is delegated to
func (*CharFormatterDelegatingFormatter) SetCharFormatter ¶ added in v0.6.1
func (c *CharFormatterDelegatingFormatter) SetCharFormatter(formatter CharFormatter)
SetCharFormatter sets the CharFormatter to be wrapped by CharFormatterDelegatingFormatter
type CryptoRand ¶
type CryptoRand struct{}
func (CryptoRand) Rand ¶
func (c CryptoRand) Rand() *big.Rat
func (CryptoRand) RandMax ¶
func (c CryptoRand) RandMax(max int) int
type FastFingerCharFormatter ¶
type FastFingerCharFormatter struct {
RandomDevice
}
FastFingerCharFormatter formats as if written with haste, skipping characters at random
func (FastFingerCharFormatter) FormatRune ¶
func (ff FastFingerCharFormatter) FormatRune(r rune) []rune
FormatRune at a rate of 1/6 randomly skip a rune
type FatFingerCharFormatter ¶
type FatFingerCharFormatter struct {
RandomDevice
}
FatFingerCharFormatter formats the text/rune as if it was types with fat fingers
func (FatFingerCharFormatter) FormatRune ¶
func (ff FatFingerCharFormatter) FormatRune(r rune) []rune
FormatRune returns the slice of runes by finding the neighboring characters (keyboard) and returns a random set of characters from within that sequence. it may return the rune itself up to four times
type Formatter ¶
Formatter is a formatter, that formats the entire input text(string) and outputs the formatted text
func DelimiterFormatterWith ¶
DelimiterFormatterWith replaces all spaces with the given string
func L337Formatter ¶
func L337Formatter() Formatter
L337Formatter returns a L337CharFormatter with a predefined mapping, the l337map
func NewFastFingerFormatter ¶
func NewFastFingerFormatter() Formatter
NewFastFingerFormatter returns an initiated FastFingerCharFormatter wrapped in a CharFormatterDelegatingFormatter to produce a Formatter
func NewFatFingerFormatter ¶
func NewFatFingerFormatter() Formatter
NewFatFingerFormatter wraps the FatFingerCharFormatter in a CharFormatterDelegatingFormatter to produce a Formatter
func NewHorseFormatter ¶ added in v0.7.1
func NewHorseFormatter() Formatter
NewHorseFormatter returns a PerWordFormattingFormatter wrapping a HorseFormatter
func NewLowercaseFormatter ¶ added in v0.7.1
func NewLowercaseFormatter() Formatter
func NewRandomlyFormatter ¶
NewRandomlyFormatter is a method that wraps a given Formatter, with the RandomlyFormattingFormatter that is wrapped with a PerWordFormattingFormatter
func NewSarcasticFormatter ¶
func NewSarcasticFormatter() Formatter
NewSarcasticFormatter returns a CharFormatterDelegatingFormatter that wraps a RandomlyFormattingCharFormatter that randomly delegates to SwitchCaseCharFormatter
func NewShuffleFormatter ¶ added in v0.7.1
func NewShuffleFormatter() Formatter
NewShuffleFormatter returns a PerWordFormattingFormatter wrapping a ShuffleFormatter
func NewStudderFormatter ¶ added in v0.7.1
func NewStudderFormatter() Formatter
NewStudderFormatter returns a PerWordFormattingFormatter that wraps a StudderFormatter
func NewSwearFormatter ¶ added in v0.6.1
func NewSwearFormatter() Formatter
NewSwearFormatter reuturns a Formatter that replaces each character in a word with cartoonish swear
func NewUppercaseFormatter ¶ added in v0.7.1
func NewUppercaseFormatter() Formatter
func NewWordReversingFormatter ¶ added in v0.3.1
func NewWordReversingFormatter() Formatter
NewWordReversingFormatter returns a ReversingFormatter that reverses each words in a group, and not the entire text as one
func RandomTitleFormatter ¶
func RandomTitleFormatter() Formatter
RandomTitleFormatter returns a formatter that titles only every other time
func Uber1337Formatter ¶
func Uber1337Formatter() Formatter
Uber1337Formatter returns an initiated randomly chosen L337CharFormatter with the special uber1337-map
type HorseFormatter ¶ added in v0.7.1
type HorseFormatter struct {
RandomDevice
}
HorseFormatter returns horse-related banter for each call
func (HorseFormatter) Format ¶ added in v0.7.1
func (s HorseFormatter) Format(_ string) string
Format returns a random horse-related word
type L337CharFormatter ¶
type L337CharFormatter struct {
// contains filtered or unexported fields
}
L337CharFormatter is a CharFormatter that formats by replacing the given rune by a slice if runes as stated in the internal map
func (L337CharFormatter) FormatRune ¶
func (u L337CharFormatter) FormatRune(r rune) []rune
FormatRune returns the rune-slice given in the internal map, or returns the input value
type LowercaseCharFormatter ¶
type LowercaseCharFormatter struct{}
LowercaseCharFormatter formats lowercase
func (LowercaseCharFormatter) FormatRune ¶
func (LowercaseCharFormatter) FormatRune(r rune) []rune
FormatRune the rune, but lowercase
type MultiFormatter ¶
type MultiFormatter struct {
Formatters []Formatter
}
MultiFormatter is a wrapper to handle formatting with multiple Formatters
func (*MultiFormatter) Format ¶
func (m *MultiFormatter) Format(word string) string
Format delegates/reassigns the input string sequentially for all formatters
func (*MultiFormatter) With ¶
func (m *MultiFormatter) With(f Formatter)
With appends a given Formatter to the Formatters in MultiFormatter
type PerWordFormattingFormatter ¶ added in v0.3.1
type PerWordFormattingFormatter struct {
Other Formatter
}
PerWordFormattingFormatter delegates to another Formatter, but calls the Format method for each word
func (*PerWordFormattingFormatter) Format ¶ added in v0.3.1
func (p *PerWordFormattingFormatter) Format(word string) string
Format splits the text on space, and calls Other > Format for each word, then joining the text again.
func (*PerWordFormattingFormatter) GetFormatter ¶ added in v0.6.1
func (p *PerWordFormattingFormatter) GetFormatter() Formatter
GetFormatter returns the wrapped formatter of PerWordFormattingFormatter
func (*PerWordFormattingFormatter) SetFormatter ¶ added in v0.6.1
func (p *PerWordFormattingFormatter) SetFormatter(formatter Formatter)
SetFormatter sets the Formatter that PerWordFormattingFormatter should wrap
type RandomDevice ¶
type RandomlyFormattingCharFormatter ¶
type RandomlyFormattingCharFormatter struct { Other CharFormatter // contains filtered or unexported fields }
RandomlyFormattingCharFormatter is a CharFormatter that delegates randomly to the embedded CharFormatter: Other
func NewRandomFormatter ¶
func NewRandomFormatter() *RandomlyFormattingCharFormatter
NewRandomFormatter is a Returns a RandomlyFormattingCharFormatter that delegates to another CharFormatter at a rate of 50%
func (*RandomlyFormattingCharFormatter) FormatRune ¶
func (rff *RandomlyFormattingCharFormatter) FormatRune(r rune) []rune
FormatRune formats a single rune or not given the Random with threshold
func (*RandomlyFormattingCharFormatter) GetCharFormatter ¶ added in v0.6.1
func (rff *RandomlyFormattingCharFormatter) GetCharFormatter() CharFormatter
func (*RandomlyFormattingCharFormatter) SetCharFormatter ¶ added in v0.6.1
func (rff *RandomlyFormattingCharFormatter) SetCharFormatter(wrap CharFormatter)
type RandomlyFormattingFormatter ¶
type RandomlyFormattingFormatter struct { Other Formatter // contains filtered or unexported fields }
RandomlyFormattingFormatter is a formatter that formats at a rate of 50%
func (*RandomlyFormattingFormatter) Format ¶
func (rff *RandomlyFormattingFormatter) Format(word string) string
Format calls the Other > Format at a rate of 50%
func (*RandomlyFormattingFormatter) GetFormatter ¶ added in v0.6.1
func (rff *RandomlyFormattingFormatter) GetFormatter() Formatter
GetFormatter returns the Formatter that RandomlyFormattingFormatter wraps
func (*RandomlyFormattingFormatter) SetFormatter ¶ added in v0.6.1
func (rff *RandomlyFormattingFormatter) SetFormatter(wrap Formatter)
SetFormatter sets the wrapped Formatter of RandomlyFormattingFormatter
type RegexReplacingFormatter ¶
type RegexReplacingFormatter struct { // PatternMatcher is a regexp.Regexp, to match against the text PatternMatcher *regexp.Regexp // Replacement is whatever is to be replaced by the given PatternMatcher Replacement string }
RegexReplacingFormatter is a Formatter that performs a regex replace functionality on the given text
func (*RegexReplacingFormatter) Format ¶
func (rr *RegexReplacingFormatter) Format(word string) string
Format replaces all instances of the given regex PatternMatcher with the Replacement
type ReversingFormatter ¶ added in v0.3.1
type ReversingFormatter struct{}
ReversingFormatter reverses the string
func (ReversingFormatter) Format ¶ added in v0.3.1
func (ReversingFormatter) Format(text string) string
Format reverses the input text
type ShuffleFormatter ¶ added in v0.7.1
type ShuffleFormatter struct {
RandomDevice
}
ShuffleFormatter shuffles the given string
func (ShuffleFormatter) Format ¶ added in v0.7.1
func (s ShuffleFormatter) Format(text string) string
Format shuffles the characters of an input string and returns a new shuffled string
type StudderFormatter ¶ added in v0.7.1
type StudderFormatter struct {
RandomDevice
}
StudderFormatter is a formatter that writes text that appear like it's studdering
func (StudderFormatter) Format ¶ added in v0.7.1
func (s StudderFormatter) Format(word string) string
Format will return the first character of a word plus '-' up to 4 times, and the word
type SwitchCaseCharFormatter ¶
type SwitchCaseCharFormatter struct{}
SwitchCaseCharFormatter switch the case
func (SwitchCaseCharFormatter) FormatRune ¶
func (SwitchCaseCharFormatter) FormatRune(r rune) []rune
FormatRune switches case of the rune
type TitleFormatter ¶
type TitleFormatter struct{}
TitleFormatter is a Formatter that Titles the given text
func (TitleFormatter) Format ¶
func (TitleFormatter) Format(word string) string
Format calls strings.Title on the given text
type UnitFormatter ¶
type UnitFormatter struct{}
UnitFormatter is a Noop Formatter and CharFormatter implementation
func (UnitFormatter) Format ¶
func (UnitFormatter) Format(words string) string
Format returns the input
func (UnitFormatter) FormatRune ¶
func (UnitFormatter) FormatRune(r rune) []rune
FormatRune return the rune wrapped in a slice
type UppercaseCharFormatter ¶
type UppercaseCharFormatter struct{}
UppercaseCharFormatter formats uppercase
func (UppercaseCharFormatter) FormatRune ¶
func (UppercaseCharFormatter) FormatRune(r rune) []rune
FormatRune uppercases the rune
type WrappingCharFormatter ¶ added in v0.6.1
type WrappingCharFormatter interface { CharFormatter SetCharFormatter(CharFormatter) GetCharFormatter() CharFormatter }
WrappingCharFormatter is an interface of a CharFormatter that wraps another CharFormatter
type WrappingFormatter ¶ added in v0.6.1
WrappingFormatter is an interface of a Formatter that wraps another Formatter