var bdcom = { isObj(object) { return object && typeof(object) == 'object' && Object.prototype.toString.call(object).toLowerCase() == "[object object]"; }, isArray(object) { return object && typeof(object) == 'object' && object.constructor == Array; }, compute(objA) { for (var key in objA) { if (this.isObj(objA[key])) { var oA = objA[key]; this.compute(oA); } else if (!this.isArray(objA[key])) { //子级不是数组时,比较属性值 if (key.indexOf('-') > 0) { var _key = key.replace("-", ""); objA[_key] = objA[key]; // delete objA[key]; //js方法 } } else { var oA = objA[key]; for (var k in oA) { this.compute(oA); } } } }, } module.exports = bdcom;