Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RandomText

Random generator for various text values like names, addresses or phone numbers.

Example

let value1 = RandomText.name();     // Possible result: "Segio"
let value2 = RandomText.verb();      // Possible result: "Run"
let value3 = RandomText.Text(50);    // Possible result: "Run jorge. Red high scream?"

Hierarchy

  • RandomText

Index

Methods

Static adjective

  • adjective(): string
  • Generates a random adjective. The result value is capitalized.

    Returns string

    a random adjective.

Static color

  • color(): string
  • Generates a random color name. The result value is capitalized.

    Returns string

    a random color name.

Static email

  • email(): string
  • Generates a random email address.

    Returns string

    a random email address.

Static fullName

  • fullName(): string
  • Generates a random person's name which has the following structure

    Returns string

    a random name.

Static noun

  • noun(): string
  • Generates a random noun. The result value is capitalized.

    Returns string

    a random noun.

Static phone

  • phone(): string
  • Generates a random phone number. The phone number has the format: (XXX) XXX-YYYY

    Returns string

    a random phone number.

Static phrase

  • phrase(minLength: number, maxLength?: number): string
  • Generates a random phrase which consists of few words separated by spaces. The first word is capitalized, others are not.

    Parameters

    • minLength: number

      (optional) minimum string length.

    • Default value maxLength: number = null

      maximum string length.

    Returns string

    a random phrase.

Static text

  • text(minLength: number, maxLength?: number): string
  • Generates a random text, consisting of first names, last names, colors, stuffs, adjectives, verbs, and punctuation marks.

    Parameters

    • minLength: number

      minimum amount of words to generate. Text will contain 'minSize' words if 'maxSize' is omitted.

    • Default value maxLength: number = null

      (optional) maximum amount of words to generate.

    Returns string

    a random text.

Static verb

  • verb(): string
  • Generates a random verb. The result value is capitalized.

    Returns string

    a random verb.

Static word

  • word(): string
  • Generates a random word from available first names, last names, colors, stuffs, adjectives, or verbs.

    Returns string

    a random word.

Static words

  • words(min: number, max?: number): string
  • Generates a random text that consists of random number of random words separated by spaces.

    Parameters

    • min: number

      (optional) a minimum number of words.

    • Default value max: number = null

      a maximum number of words.

    Returns string

    a random text.

Generated using TypeDoc