Skip to content

Commit

Permalink
remove flatten for now
Browse files Browse the repository at this point in the history
  • Loading branch information
amirrr committed Jul 14, 2024
1 parent ef332a5 commit 1d91d8c
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions client/src/components/View/TableView/hooks/data-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,32 +46,6 @@ export type TableData = {
rows: KeyValuePairs[]
}

export function flatten(
object: object,
array_key = Object.keys(object).find((key) => Array.isArray(object[key])),
): unknown {
return Array.isArray(object)
? object.flatMap((item) => flatten(item))
: array_key
? object[array_key].flatMap((array_value) =>
flatten({
...Object.keys(object)
.filter((key) => key != array_key)
.reduce((new_object, key) => ({ ...new_object, [key]: object[key] }), {}),
...(typeof array_value == 'object'
? Object.keys(array_value).reduce(
(new_object, key) => ({
...new_object,
[`${array_key} ${key}`]: array_value[key],
}),
{},
)
: { [array_key]: array_value }),
}),
)
: object
}

export const flattenData = (
data: Result[],
expandedExperiment: boolean,
Expand Down

0 comments on commit 1d91d8c

Please sign in to comment.