1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-06-26 01:10:14 +02:00
TableFilter/src/helpers.js

20 lines
358 B
JavaScript
Raw Normal View History

2014-11-16 01:29:07 +01:00
/**
* Misc helpers
*/
2016-05-20 09:21:42 +02:00
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(',', '.');
2014-11-16 01:29:07 +01:00
}
2016-05-20 09:21:42 +02:00
return n;
}