feat(invoice-ninja): add create client action

This commit is contained in:
Rıdvan Akca
2023-10-09 14:52:05 +03:00
committed by Faruk AYDIN
parent c4af873036
commit 5b13f880c8
7 changed files with 508 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import isObject from 'lodash/isObject';
export function filterProvidedFields(body: Record<string, unknown>) {
return Object.keys(body).reduce<Record<string, unknown>>((result, key) => {
const value = body[key];
if (isObject(value)) {
const filteredNestedObj = filterProvidedFields(
value as Record<string, unknown>
);
if (Object.keys(filteredNestedObj).length > 0) {
result[key] = filteredNestedObj;
}
} else if (body[key]) {
result[key] = value;
}
return result;
}, {});
}