1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2026-03-16 07:35:45 +01:00

Started filtersVisibility extension

This commit is contained in:
Max Guglielmi 2015-06-06 20:06:15 +10:00
commit 8768f653ac
48 changed files with 515 additions and 618 deletions

46
src/string.js Normal file
View file

@ -0,0 +1,46 @@
/**
* String utilities
*/
export default {
lower(text){
return text.toLowerCase();
},
upper(text){
return text.toUpperCase();
},
trim(text){
if (text.trim){
return text.trim();
}
return text.replace(/^\s*|\s*$/g, '');
},
isEmpty(text){
return this.trim(text) === '';
},
rgxEsc(text){
function escape(e){
let a = new RegExp('\\'+e, 'g');
text = text.replace(a, '\\'+e);
}
let chars = ['\\','[','^','$','.','|','?','*','+','(',')'];
for(let e=0, len=chars.length; e<len; e++){
escape(chars[e]);
}
return text;
},
matchCase(text, mc){
if(!mc){
return this.lower(text);
}
return text;
}
};