@nospamproxy/core
    Preparing search index...

    Value converter to truncate values in the middle. Refer the common/value-converters/truncateMiddle!truncateMiddle | truncateMiddle core function for more details.

    <!-- binds '1234...9' to value -->
    <normal-text value.bind="'123456789' | truncateMiddle:8"></normal-text>
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Parameters

      • value: string | null | undefined
      • maxLength: number
      • preserveStart: number = 0.8

      Returns string | null | undefined

    • Truncates the given value in the middle if the length of the value exceeds the given maxLength.

      Parameters

      • value: string | null | undefined

        The value to truncate.

      • maxLength: number

        The maximum length of the output.

      • preserveStart: number

        The percentage of the string to preserve from the beginning. The value is expressed by an open interval of (0, 1). If this value is closer to 1 the truncation happens near the end of the string and when it is closer to 0 the truncation happens near the beginning of the string.

      Returns string | null | undefined

      The truncated value.

      truncateMiddle('123456789', 8, 0.8) // '1234...9'
      truncateMiddle('123456789', 8, 0.2) // '1...6789'