You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any chance of having the ability to format with an object rather than string, e.g.: format({ precision: 2, type: 'f' })(1.234);
Rather than: format(".2f")(1.234);
I think it would be nice to allow being that explicit.
I also have a use case for it where I want to convert from other types of format strings into d3-format style. It's easier to convert from "other" to the specifier object, rather than the extra step of making that object a string as well.
I can see it being possible directly in the format function, or if the FormatSpecifier class was exported and had a constructor that accepts either an object or string: const specifier = new FormatSpecifier({ precision: 2, type: 'f'}).toString(); format(specifier)(1.2345);
The text was updated successfully, but these errors were encountered:
Is there any chance of having the ability to format with an object rather than string, e.g.:
format({ precision: 2, type: 'f' })(1.234);
Rather than:
format(".2f")(1.234);
I think it would be nice to allow being that explicit.
I also have a use case for it where I want to convert from other types of format strings into d3-format style. It's easier to convert from "other" to the specifier object, rather than the extra step of making that object a string as well.
I can see it being possible directly in the format function, or if the FormatSpecifier class was exported and had a constructor that accepts either an object or string:
const specifier = new FormatSpecifier({ precision: 2, type: 'f'}).toString();
format(specifier)(1.2345);
The text was updated successfully, but these errors were encountered: