Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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');
}
if (classArr.indexOf('htNumeric') < 0) {
classArr.push('htNumeric');
}
cellProperties.className = classArr.join(' ');
}
getRenderer('text')(instance, TD, row, col, prop, newValue, cellProperties);
setLocale(locale: string) {
LocaleConfig.defaultLocale = locale;
numbro.registerLanguage(Languages[locale]);
numbro.setLanguage(locale);
}
}
const toCurrency = (number, decimal) => {
if (is.number(number)) {
if (props.language) {
let i = 0;
const langKeys = Object.keys(languages);
const langMax = langKeys.length;
for (; i < langMax; i += 1) {
const langKey = langKeys[i];
const lang = languages[langKey];
numbro.registerLanguage(lang);
}
numbro.setLanguage(props.language);
}
const currency = numbro(number);
const { format } = props;
if (decimal) {
format.mantissa = decimal;
}
return currency.formatCurrency(format);
}
return number;
};
const hasNumberProperty = (obj, property) => Object.prototype.hasOwnProperty.call(obj, property) && is.number(obj[property]);