feat: export reports csv and xlsx (#286)

This commit is contained in:
Ahmed Bouhuolia
2023-11-28 19:53:13 +02:00
committed by GitHub
parent 151aff4c8e
commit d15c5890ed
125 changed files with 4674 additions and 934 deletions

View File

@@ -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,
};