(Follow-up from #32 (comment))
What should the name and shape of the show/hide zeroes option be?
Some questions for discussion:
A) Negative (e.g. hideXxx) vs. positive (showXxx) vs. neutral (e.g. zero)
- Most other APIs seem to use positive options more frequently than negative ones. So I'd suggest either positive or neutral names.
B) One option or three options (one each for leading, trailing, and internal) ?
- AFAICT, showing leading, trailing, and internal zero values are unrelated choices. An 8-value enum to support all permutations is too complex. So unless I'm missing something obvious, I assume this means that using three separate options would be best.
C) Align naming with similar option(s) in other APIs?
- @sffc mentioned one in the meeting but I forget what it was (maybe NumberFormat V3?) that uses a trailing-zeroes option. Seems like a good idea to align.
D) How will these options interact with style?
- For example, the
'digital' style probably requires internal zeroes to be shown, while the 'long' style would allow (or perhaps default to?) hiding internal zeroes.
Taking the questions above into account, here's a few choices. In all cases the default would be 'auto' which means "use the defaults appropriate for the style".
1. Three separate options
{
trailingZeroFields: 'show' | 'hide' | 'auto';
leadingZeroFields: 'show' | 'hide' | 'auto';
internalZeroFields: 'show' | 'hide' | 'auto';
}
2. Nested options
The caller could either apply the same value to all three positions using a single string value, or could choose different values for leading vs. trailing vs. internal by providing an object bag as a value.
{
zeroFields:
'show' |
'hide' |
'auto' |
{
leading?: 'show' | 'hide' | 'auto';
trailing?: 'show' | 'hide' | 'auto';
internal?: 'show' | 'hide' | 'auto';
};
}
(Follow-up from #32 (comment))
What should the name and shape of the show/hide zeroes option be?
Some questions for discussion:
A) Negative (e.g. hideXxx) vs. positive (showXxx) vs. neutral (e.g.
zero)B) One option or three options (one each for leading, trailing, and internal) ?
C) Align naming with similar option(s) in other APIs?
D) How will these options interact with
style?'digital'style probably requires internal zeroes to be shown, while the'long'style would allow (or perhaps default to?) hiding internal zeroes.Taking the questions above into account, here's a few choices. In all cases the default would be
'auto'which means "use the defaults appropriate for thestyle".1. Three separate options
2. Nested options
The caller could either apply the same value to all three positions using a single string value, or could choose different values for leading vs. trailing vs. internal by providing an object bag as a value.