Options
All
  • Public
  • Public/Protected
  • All
Menu

Module string/template

Index

References

Functions

References

Renames and re-exports template

Functions

  • template(replacements: Record<string, string>, str?: string): string
  • template(replacements: Record<string, string>): (str?: string) => string
  • Replaces string keywords with provided values

    example
     template({ fruit: 'banana' }, 'Petya has a %{fruit}') //=> Petya has a banana
    

    Parameters

    • replacements: Record<string, string>

      object with keywords and corresponding replacements

    • Optional str: string

      string with keywords in a correct format '%{keyword}'

    Returns string

    String with replaced keywords

  • Replaces string keywords with provided values

    example
     template({ fruit: 'banana' }, 'Petya has a %{fruit}') //=> Petya has a banana
    

    Parameters

    • replacements: Record<string, string>

      object with keywords and corresponding replacements

    Returns (str?: string) => string

    String with replaced keywords

      • (str?: string): string
      • Parameters

        • Optional str: string

        Returns string

Generated using TypeDoc