mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(util) isContainStr
This commit is contained in:
parent
033c1308d2
commit
97689e6c75
1 changed files with 13 additions and 10 deletions
23
lib/util.js
23
lib/util.js
|
|
@ -388,21 +388,24 @@
|
|||
*/
|
||||
|
||||
this.isContainStr = function(pStr1, pStr2) {
|
||||
var lRet = Util.isString(pStr1);
|
||||
var i, n, regExp, str,
|
||||
ret = Util.isString(pStr1);
|
||||
|
||||
if ( lRet ) {
|
||||
if ( Util.isArray(pStr2) )
|
||||
for(var i = 0, n = pStr2.length; i < n; i++) {
|
||||
lRet = Util.isContainStr( pStr1, pStr2[i] );
|
||||
if (ret)
|
||||
if (Util.isArray(pStr2)) {
|
||||
n = pStr2.length;
|
||||
|
||||
for(i = 0; i < n; i++) {
|
||||
str = pStr2[i];
|
||||
ret = Util.isContainStr(pStr1, str);
|
||||
|
||||
if (lRet)
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
else if ( Util.isString(pStr2) )
|
||||
lRet = pStr1.indexOf(pStr2) >= 0;
|
||||
}
|
||||
} else if (Util.isString(pStr2))
|
||||
ret = pStr1.indexOf(pStr2) >= 0;
|
||||
|
||||
return lRet;
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue