MCPcopy Create free account
hub / github.com/denoland/std / toLocaleString

Function toLocaleString

fmt/bytes.ts:194–206  ·  view source on GitHub ↗

* 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,
)

Source from the content-addressed store, hash-verified

192 * - If no value for locale is specified, the number is returned unmodified.
193 */
194function 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}

Callers 1

formatFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected