Options
All
  • Public
  • Public/Protected
  • All
Menu

Module repeat

Index

Functions String

String Functions

  • repeat(str: string, n?: number, guard?: any): string
  • Repeats the given string n times.

    since

    5.7.0

    example
    repeat('*', 3)
    // => '***'

    repeat('abc', 2)
    // => 'abcabc'

    repeat('abc', 0)
    // => ''

    Parameters

    • str: string

      The string to repeat.

    • n: number = 1

      The number of times to repeat the string.

    • Optional guard: any

    Returns string

    Returns the repeated string.