* 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)
| 10 | * @return {Intl.NumberFormatOptions} |
| 11 | */ |
| 12 | function 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 |