mirror of
https://github.com/koalyptus/TableFilter.git
synced 2026-03-16 07:35:45 +01:00
added src-es6 folder
This commit is contained in:
parent
e8fba7cedd
commit
5a3a989af0
52 changed files with 2914 additions and 762 deletions
|
|
@ -1,50 +1,50 @@
|
|||
/**
|
||||
* String utilities
|
||||
*/
|
||||
define(["exports"], function (exports) {
|
||||
"use strict";
|
||||
|
||||
define(function () {
|
||||
'use strict';
|
||||
/**
|
||||
* String utilities
|
||||
*/
|
||||
|
||||
var Str = {};
|
||||
var Str = {};
|
||||
|
||||
Str.lower = function(text){
|
||||
return text.toLowerCase();
|
||||
};
|
||||
Str.lower = function (text) {
|
||||
return text.toLowerCase();
|
||||
};
|
||||
|
||||
Str.upper = function(text){
|
||||
return text.toUpperCase();
|
||||
};
|
||||
Str.upper = function (text) {
|
||||
return text.toUpperCase();
|
||||
};
|
||||
|
||||
Str.trim = function(text){
|
||||
if (text.trim){
|
||||
return text.trim();
|
||||
}
|
||||
return text.replace(/^\s*|\s*$/g, '');
|
||||
};
|
||||
Str.trim = function (text) {
|
||||
if (text.trim) {
|
||||
return text.trim();
|
||||
}
|
||||
return text.replace(/^\s*|\s*$/g, "");
|
||||
};
|
||||
|
||||
Str.isEmpty = function(text){
|
||||
return this.trim(text) === '';
|
||||
};
|
||||
Str.isEmpty = function (text) {
|
||||
return this.trim(text) === "";
|
||||
};
|
||||
|
||||
Str.rgxEsc = function(text){
|
||||
function escape(e){
|
||||
var a = new RegExp('\\'+e,'g');
|
||||
text = text.replace(a,'\\'+e);
|
||||
}
|
||||
Str.rgxEsc = function (text) {
|
||||
function escape(e) {
|
||||
var a = new RegExp("\\" + e, "g");
|
||||
text = text.replace(a, "\\" + e);
|
||||
}
|
||||
|
||||
var chars = ['\\','[','^','$','.','|','?','*','+','(',')'];
|
||||
for(var e=0; e<chars.length; e++){
|
||||
escape(chars[e]);
|
||||
}
|
||||
return text;
|
||||
};
|
||||
var chars = ["\\", "[", "^", "$", ".", "|", "?", "*", "+", "(", ")"];
|
||||
for (var e = 0; e < chars.length; e++) {
|
||||
escape(chars[e]);
|
||||
}
|
||||
return text;
|
||||
};
|
||||
|
||||
Str.matchCase = function(text, mc){
|
||||
if(!mc){
|
||||
return this.lower(text);
|
||||
}
|
||||
return text;
|
||||
};
|
||||
Str.matchCase = function (text, mc) {
|
||||
if (!mc) {
|
||||
return this.lower(text);
|
||||
}
|
||||
return text;
|
||||
};
|
||||
|
||||
return Str;
|
||||
});
|
||||
exports.Str = Str;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue