武将战力计算(进阶,穿戴,羁绊,好感)加道具
This commit is contained in:
+25
-1
@@ -410,4 +410,28 @@ export function getItems(str:string) {
|
||||
});
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
export function deepCopy (obj) {
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return obj;
|
||||
}
|
||||
var target;
|
||||
if (obj instanceof Array) {
|
||||
target = [];
|
||||
obj.forEach(element => {
|
||||
target.push(deepCopy(element));
|
||||
});
|
||||
} else {
|
||||
target = {};
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
const element = obj[key];
|
||||
if (!!element || element == 0) {
|
||||
target[key] = deepCopy(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
Reference in New Issue
Block a user