* Formats the given number using `Number#toLocaleString`. * - If locale is a string, the value is expected to be a locale-key (for example: `de`). * - If locale is true, the system default locale is used for translation. * - If no value for locale is specified, the number is returned unmodified.
( num: number, locale: boolean | string | string[] | undefined, options: LocaleOptions | undefined, )
| 192 | * - If no value for locale is specified, the number is returned unmodified. |
| 193 | */ |
| 194 | function toLocaleString( |
| 195 | num: number, |
| 196 | locale: boolean | string | string[] | undefined, |
| 197 | options: LocaleOptions | undefined, |
| 198 | ): string { |
| 199 | if (typeof locale === "string" || Array.isArray(locale)) { |
| 200 | return num.toLocaleString(locale, options); |
| 201 | } else if (locale === true || options !== undefined) { |
| 202 | return num.toLocaleString(undefined, options); |
| 203 | } |
| 204 | |
| 205 | return num.toString(); |
| 206 | } |