2021-06-21 16:32:10 +08:00

18 lines
442 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
合并node对象对于相同的属性后面覆盖前面
*/
class ObjectOperation {
static combineObject(...objs) {
if (objs.length == 1 && objs[0] instanceof Array) {
objs = objs[0];
}
let sum = {};
let length = objs.length;
for (let i = 0; i < length; i++) {
sum = Object.assign(sum,objs[i]);
}
return sum;
}
}
export default ObjectOperation