lambda-live-debugger
Version:
Debug Lambda functions locally like it is running in the cloud
29 lines (28 loc) • 580 B
JavaScript
/**
* Combine two objects with string values into one object with string values.
* @param a
* @param b
* @returns
*/
export function combineObjectStrings(a, b) {
if (!a && !b) {
return {};
}
if (!a) {
return b;
}
if (!b) {
return a;
}
// for each propety merge string and seperate with /n
const result = { ...a };
for (const key in b) {
if (result[key]) {
result[key] = `${result[key]}\n${b[key]}`;
}
else {
result[key] = b[key];
}
}
return result;
}