Library API
    Preparing search index...

    Function formatList

    • Returns a localized list string using Intl.ListFormat. Falls back to a simple comma-joined string if formatting fails.

      Parameters

      • list: string[]

        The array of strings to format

      • Optionallocale: string

        Optional locale string

      • type: ListFormatType = 'conjunction'

        The list format type (default: 'conjunction')

      • style: ListFormatStyle = 'long'

        The list format style (default: 'long')

      Returns string

      The localized list string

      formatList(['A', 'B', 'C'], 'en'); // 'A, B, and C'