mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(util) rm checkObj, checkObjTrue
This commit is contained in:
parent
a101490f31
commit
e0d57bf2a7
1 changed files with 0 additions and 64 deletions
64
lib/util.js
64
lib/util.js
|
|
@ -162,70 +162,6 @@
|
|||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check is Properties exists and they are true if neaded
|
||||
*
|
||||
* @param pObj
|
||||
* @param pPropArr
|
||||
* @param pTrueArr
|
||||
*/
|
||||
this.checkObj = function(pObj, pPropArr, pTrueArr) {
|
||||
var ret,
|
||||
i, n;
|
||||
|
||||
if (pObj) {
|
||||
ret = Util.isArray(pPropArr);
|
||||
if (ret) {
|
||||
n = pPropArr.length;
|
||||
for (i = 0; i < n; i++) {
|
||||
var lProp = pPropArr[i];
|
||||
ret = pObj.hasOwnProperty(lProp);
|
||||
if (!ret) {
|
||||
console.trace();
|
||||
Util.logError(lProp + ' not in Obj!');
|
||||
Util.log(pObj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ret && Util.isArray(pTrueArr))
|
||||
ret = Util.checkObjTrue(pObj, pTrueArr);
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check is Properties exists and they are true
|
||||
*
|
||||
* @param pObj
|
||||
* @param pPropArr
|
||||
* @param pTrueArr
|
||||
*/
|
||||
this.checkObjTrue = function(pObj, pTrueArr) {
|
||||
var ret, lTrueArr,
|
||||
i, n;
|
||||
if (pObj) {
|
||||
lTrueArr = Util.isArray(pTrueArr) ? pTrueArr : [pTrueArr];
|
||||
|
||||
n = lTrueArr.length;
|
||||
for(i = 0; i < n; i++) {
|
||||
var lProp = lTrueArr[i];
|
||||
ret = pObj[lProp];
|
||||
|
||||
if (!ret) {
|
||||
console.trace();
|
||||
Util.logError(lProp + ' not true!');
|
||||
Util.log(pObj);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* Copy properties from from to to
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue