1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2026-03-18 08:29:50 +01:00
TableFilter/src-es6/helpers.js
2015-05-30 22:23:33 +10:00

27 lines
507 B
JavaScript

/**
* Misc helpers
*/
import Str from './string';
export default {
isIE(){
return (/msie|MSIE/).test(navigator.userAgent);
},
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;
}
};