Options
All
  • Public
  • Public/Protected
  • All
Menu

Module string/truncate

Index

References

Interfaces

Functions

References

Renames and re-exports truncate

Functions

  • truncate(maxLength: number, value: string, suffix?: string): string
  • truncate(maxLength: number): (value: string, suffix?: string) => string
  • Truncate a string to maxLength and append a suffix.

    example
     truncate('hello world', 100);  //=> 'hello world'
    truncate('hello world', 5); //=> 'hello…'
    truncate('你好,世界', 2); //=> '你好…'

    Parameters

    • maxLength: number
    • value: string
    • Optional suffix: string

    Returns string

  • Truncate a string to maxLength and append a suffix.

    example
     truncate('hello world', 100);  //=> 'hello world'
    truncate('hello world', 5); //=> 'hello…'
    truncate('你好,世界', 2); //=> '你好…'

    Parameters

    • maxLength: number

    Returns (value: string, suffix?: string) => string

      • (value: string, suffix?: string): string
      • Parameters

        • value: string
        • Optional suffix: string

        Returns string

Generated using TypeDoc