mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-05-23 00:32:21 +02:00
24 lines
445 B
JavaScript
24 lines
445 B
JavaScript
/**
|
|
* Misc helpers
|
|
*/
|
|
|
|
import Str from './string';
|
|
|
|
export default {
|
|
removeNbFormat(data, format) {
|
|
if (!data) {
|
|
return;
|
|
}
|
|
if (!format) {
|
|
format = 'us';
|
|
}
|
|
let n = data;
|
|
if (Str.lower(format) === 'us') {
|
|
n = + n.replace(/[^\d\.-]/g, '');
|
|
} else {
|
|
n = + n.replace(/[^\d\,-]/g, '').replace(',', '.');
|
|
}
|
|
return n;
|
|
}
|
|
};
|