1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-06-16 04:35:27 +02:00
TableFilter/src-es6/helpers.js

28 lines
507 B
JavaScript
Raw Normal View History

2014-11-16 01:29:07 +01:00
/**
* Misc helpers
*/
2015-05-30 14:23:33 +02:00
import Str from './string';
2015-04-04 10:10:09 +02:00
2015-05-30 14:23:33 +02:00
export default {
isIE(){
2014-11-16 01:29:07 +01:00
return (/msie|MSIE/).test(navigator.userAgent);
},
removeNbFormat(data, format){
if(!data){
return;
}
if(!format){
format = 'us';
}
2015-05-30 14:23:33 +02:00
let n = data;
2015-04-04 10:10:09 +02:00
if(Str.lower(format)==='us'){
n =+ n.replace(/[^\d\.-]/g,'');
} else {
n =+ n.replace(/[^\d\,-]/g,'').replace(',','.');
}
return n;
2014-11-16 01:29:07 +01:00
}
};