mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
Merge branch 'develop' into optimize-printing
This commit is contained in:
@@ -78,6 +78,27 @@ const filterNodesDeep = (predicate, nodes) => {
|
||||
);
|
||||
};
|
||||
|
||||
const flatNestedTree = (obj, mapper, options) => {
|
||||
return reduceDeep(
|
||||
obj,
|
||||
(accumulator, value, key, parentValue, context) => {
|
||||
const computedValue = _.omit(value, ['children']);
|
||||
const mappedValue = mapper
|
||||
? mapper(computedValue, key, context)
|
||||
: computedValue;
|
||||
|
||||
accumulator.push(mappedValue);
|
||||
return accumulator;
|
||||
},
|
||||
[],
|
||||
{
|
||||
childrenPath: 'children',
|
||||
pathFormat: 'array',
|
||||
...options,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export {
|
||||
iteratee,
|
||||
condense,
|
||||
@@ -103,4 +124,5 @@ export {
|
||||
someDeep,
|
||||
mapValuesDeepReverse,
|
||||
filterNodesDeep,
|
||||
flatNestedTree,
|
||||
};
|
||||
|
||||
@@ -22,7 +22,9 @@ export function tableRowMapper(
|
||||
): ITableRow {
|
||||
const cells = columns.map((column) => ({
|
||||
key: column.key,
|
||||
value: column.value ? column.value : getAccessor(object, column.accessor),
|
||||
value: column.value
|
||||
? column.value
|
||||
: getAccessor(object, column.accessor) || '',
|
||||
}));
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user