mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-19 01:17:18 +00:00
added ability to pass checkExtension function array of extensions
This commit is contained in:
parent
edde810a74
commit
dc49740c08
2 changed files with 18 additions and 13 deletions
|
|
@ -280,17 +280,22 @@ CloudFunc.checkExtension=function(pName,pExt)
|
|||
* длинны расширения -
|
||||
* имеет смысл продолжать
|
||||
*/
|
||||
if(pName.length>pExt.length){
|
||||
var lLength=pName.length; /* длина имени*/
|
||||
var lExtNum=pName.lastIndexOf(pExt);/* последнее вхождение расширения*/
|
||||
var lExtSub=lLength-lExtNum; /* длина расширения*/
|
||||
/* если pExt - расширение pName */
|
||||
if(lExtSub===pExt.length)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else return false;
|
||||
if (typeof pExt === 'string' &&
|
||||
pName.length > pExt.length) {
|
||||
var lLength=pName.length; /* длина имени*/
|
||||
var lExtNum=pName.lastIndexOf(pExt);/* последнее вхождение расширения*/
|
||||
var lExtSub=lLength-lExtNum; /* длина расширения*/
|
||||
|
||||
/* если pExt - расширение pName */
|
||||
return lExtSub===pExt.length;
|
||||
|
||||
}else if(typeof pExt === 'object' &&
|
||||
pName.length){
|
||||
for(var i=0; i < pName.length; i++)
|
||||
if(this.checkExtension(pName, pExt[i]));
|
||||
return true;
|
||||
}else
|
||||
return false;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue