mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
feat: export reports csv and xlsx (#286)
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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user