mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-06-14 11:46:42 +02:00
20 lines
358 B
JavaScript
20 lines
358 B
JavaScript
/**
|
|
* Misc helpers
|
|
*/
|
|
|
|
export const removeNbFormat = (data, format) => {
|
|
if (!data) {
|
|
return;
|
|
}
|
|
if (!format) {
|
|
format = 'us';
|
|
}
|
|
let n = data;
|
|
if (format.toLowerCase() === 'us') {
|
|
n = + n.replace(/[^\d\.-]/g, '');
|
|
} else {
|
|
n = + n.replace(/[^\d\,-]/g, '').replace(',', '.');
|
|
}
|
|
return n;
|
|
}
|