Skip to content

listFormatter
@localizer/format-list 1.1.1

The listFormatter is a versatile tool designed to format lists of items with customizable options. It allows you to define how list elements are joined together, making it easy to adapt to various localization and formatting requirements.

Usage

typescript
import { 
loc
} from '@localizer/core';
import {
listFormatter
} from '@localizer/format-list';
const
formatter
=
listFormatter
({
delimiter
:
loc
` :: ` });
const
values
= [
loc
`A`,
loc
`B`,
loc
`C`,
loc
`D`];
const
result
=
formatter
(
values
);

See formatter options for configuration details.

Demo

─── unset ───
─── unset ───
Options object
LocaleLocalized value
en-US  American EnglishA, B, C, and D
fr-FR  French (France)A, B, C et D
de-DE  German (Germany)A, B, C und D
fi-FI  Finnish (Finland)A, B, C ja D
sv-FI  Swedish (Finland)A, B, C och D
ko-KR  Korean (South Korea)A, B, C 및 D
hi-IN  Hindi (India)A, B, C, और D

See also