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

Function getLocaleOptions

fmt/bytes.ts:169–186  ·  view source on GitHub ↗
(
  { maximumFractionDigits, minimumFractionDigits }: FormatOptions,
)

Source from the content-addressed store, hash-verified

167}
168
169function getLocaleOptions(
170 { maximumFractionDigits, minimumFractionDigits }: FormatOptions,
171): LocaleOptions | undefined {
172 if (
173 maximumFractionDigits === undefined && minimumFractionDigits === undefined
174 ) {
175 return;
176 }
177
178 const ret: LocaleOptions = {};
179 if (maximumFractionDigits !== undefined) {
180 ret.maximumFractionDigits = maximumFractionDigits;
181 }
182 if (minimumFractionDigits !== undefined) {
183 ret.minimumFractionDigits = minimumFractionDigits;
184 }
185 return ret;
186}
187
188/**
189 * Formats the given number using `Number#toLocaleString`.

Callers 1

formatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected