feature(util) rm isContainStrAtBegin

This commit is contained in:
coderaiser 2014-10-27 11:50:31 -04:00
parent 329df3e5c6
commit 57df106f0a
3 changed files with 3 additions and 33 deletions

View file

@ -99,8 +99,8 @@
*/
function sendData(params, callback) {
var p = params,
isFS = Util.isContainStrAtBegin(p.name, CloudFunc.FS),
isMD = Util.isContainStrAtBegin(p.name, '/markdown');
isFS = /^\/fs/.test(p.name),
isMD = /^\/markdown/.test(p.name);
if (isFS)
onFS(params, callback);

View file

@ -120,7 +120,7 @@
name = ponse.getPathName(request);
isAuth = Util.strCmp(name, ['/auth', '/auth/github']);
isFS = Util.strCmp(name, '/') || Util.isContainStrAtBegin(name, FS);
isFS = RegExp('^/$|' + FS).test(name);
p = {
request : request,

View file

@ -269,36 +269,6 @@
return is;
};
/**
* is pStr1 contains pStr2 at begin
* @param pStr1
* @param pStr2
*/
this.isContainStrAtBegin = function(pStr1, pStr2) {
var i, n, length, subStr, ret,
isStr1 = Util.type.string(pStr1),
isArr2 = Util.type.array(pStr2);
if (isStr1)
if (isArr2) {
n = pStr2.length;
for(i = 0; i < n; i++) {
ret = Util.isContainStrAtBegin(pStr1, pStr2[i]);
if (ret)
break;
}
} else {
length = pStr2.length,
subStr = pStr1.substring(0, length);
ret = subStr === pStr2;
}
return ret;
};
/**
* function log pArg if it's not empty
* @param pArg