Browse Source

Handle undefined object

pull/2064/head
Thomas 2 years ago
parent
commit
c1ec474012
  1. 8
      apps/api/src/helper/object.helper.ts

8
apps/api/src/helper/object.helper.ts

@ -16,9 +16,11 @@ export function hasNotDefinedValuesInObject(aObject: Object): boolean {
export function nullifyValuesInObject<T>(aObject: T, keys: string[]): T {
const object = cloneDeep(aObject);
keys.forEach((key) => {
object[key] = null;
});
if (object) {
keys.forEach((key) => {
object[key] = null;
});
}
return object;
}

Loading…
Cancel
Save