Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function numericRenderer(instance, TD, row, col, prop, value, cellProperties) {
let newValue = value;
if (isNumeric(newValue)) {
const numericFormat = cellProperties.numericFormat;
const cellCulture = numericFormat && numericFormat.culture || '-';
const cellFormatPattern = numericFormat && numericFormat.pattern;
const className = cellProperties.className || '';
const classArr = className.length ? className.split(' ') : [];
if (typeof cellCulture !== 'undefined' && !numbro.languages()[cellCulture]) {
const shortTag = cellCulture.replace('-', '');
const langData = numbro.allLanguages ? numbro.allLanguages[cellCulture] : numbro[shortTag];
if (langData) {
numbro.registerLanguage(langData);
}
}
numbro.setLanguage(cellCulture);
newValue = numbro(newValue).format(cellFormatPattern || '0');
if (classArr.indexOf('htLeft') < 0 && classArr.indexOf('htCenter') < 0 &&
classArr.indexOf('htRight') < 0 && classArr.indexOf('htJustify') < 0) {
classArr.push('htRight');
}