mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
feat: request middleware to convert empty strings to null.
This commit is contained in:
@@ -195,6 +195,16 @@ const entriesAmountDiff = (newEntries, oldEntries, amountAttribute, idAttribute)
|
||||
.value();
|
||||
};
|
||||
|
||||
const convertEmptyStringsToNull = (obj) => {
|
||||
return _.mapValues(obj, (value, key) => {
|
||||
return typeof value === 'string' ?
|
||||
value.trim() === '' ?
|
||||
null :
|
||||
value :
|
||||
value;
|
||||
});
|
||||
};
|
||||
|
||||
export {
|
||||
hashPassword,
|
||||
origin,
|
||||
@@ -214,4 +224,5 @@ export {
|
||||
getDefinedOptions,
|
||||
|
||||
entriesAmountDiff,
|
||||
convertEmptyStringsToNull,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user