MCPcopy Create free account
hub / github.com/chartjs/Chart.js / applyNumberFormat

Function applyNumberFormat

src/core/core.ticks.js:12–24  ·  view source on GitHub ↗

* Merges the user's number format over the defaults. When the format sets only one of * the fraction digit bounds, the other one follows it instead of contradicting it. * @param {Intl.NumberFormatOptions} options - the defaults, modified in place * @param {Intl.NumberFormatOptions} [format] - the

(options, format)

Source from the content-addressed store, hash-verified

10 * @return {Intl.NumberFormatOptions}
11 */
12function applyNumberFormat(options, format) {
13 Object.assign(options, format);
14
15 if (options.minimumFractionDigits > options.maximumFractionDigits) {
16 if (format.minimumFractionDigits === undefined) {
17 options.minimumFractionDigits = options.maximumFractionDigits;
18 } else if (format.maximumFractionDigits === undefined) {
19 options.maximumFractionDigits = options.minimumFractionDigits;
20 }
21 }
22
23 return options;
24}
25
26/**
27 * Namespace to hold formatters for different types of ticks

Callers 1

numericFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected