mirror of
https://github.com/acid-info/free.technology.git
synced 2025-03-01 18:00:30 +00:00
14 lines
249 B
TypeScript
14 lines
249 B
TypeScript
|
type DataObject = {
|
||
|
[key: string]: Array<any>
|
||
|
}
|
||
|
|
||
|
export const calculatElementCount = (data: DataObject): number => {
|
||
|
if (!data) {
|
||
|
return 0
|
||
|
}
|
||
|
return Object.keys(data).reduce(
|
||
|
(sum, element) => sum + data[element].length,
|
||
|
0,
|
||
|
)
|
||
|
}
|