mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
feature(util) rm isContainStr
This commit is contained in:
parent
ad87145c42
commit
5d4db87a96
5 changed files with 10 additions and 46 deletions
34
lib/util.js
34
lib/util.js
|
|
@ -235,40 +235,6 @@
|
|||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* function returns is str1 contains str2
|
||||
* @param str1
|
||||
* @param str2
|
||||
*/
|
||||
|
||||
this.isContainStr = function(str1, str2) {
|
||||
var i, n, str, is, index,
|
||||
isStr = Util.type.string(str1),
|
||||
type = Util.type(str2);
|
||||
|
||||
if (isStr)
|
||||
switch (type) {
|
||||
case 'array':
|
||||
n = str2.length;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
str = str2[i];
|
||||
is = Util.isContainStr(str1, str);
|
||||
|
||||
if (is)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'string':
|
||||
index = str1.indexOf(str2);
|
||||
is = index >= 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return is;
|
||||
};
|
||||
|
||||
/**
|
||||
* function log pArg if it's not empty
|
||||
* @param pArg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue