const countDecimalPlaces = (value) => {
if (!value) {
return 0;
}
const text = value.toString();
const i = text.indexOf('e-');
if (i > -1) {
return parseInt(text.slice(i + 2), 10);
}
const j = text.indexOf('.');
if (j > -1) {
return text.length - j - 1;
}
return 0;
};
const downloadBlob = (blob: Blob, fileName: string) => {
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.style.display = 'none';
link.href = url;
link.setAttribute('download', fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
};