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:
parent
1cf087e5bc
commit
8768f653ac
48 changed files with 515 additions and 618 deletions
46
src/string.js
Normal file
46
src/string.js
Normal 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;
|
||||
}
|
||||
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue