I use this library for formatting dollar prices.
Now, if I pass the number 0 as input to the toString() or toPlainString() methods, it returns an empty string '' , which is incorrect and should return $0 .
example:
import { NumberFormatter } from 'reduce-precision';
const formatter = new NumberFormatter({
language: 'en',
template: 'usd',
precision: 'auto',
});
const formattedPrice = formatter.toString(0) //--- returns '' but should return $0
const formattedPrice = formatter.toPlainString(0) //--- returns '' but should return $0
I use this library for formatting dollar prices.
Now, if I pass the number
0as input to thetoString()ortoPlainString()methods, it returns an empty string'', which is incorrect and should return$0.example: