MCPcopy Index your code
hub / github.com/TanStack/table / flattenBy

Function flattenBy

packages/table-core/src/utils.ts:115–134  ·  view source on GitHub ↗
(
  arr: TNode[],
  getChildren: (item: TNode) => TNode[],
)

Source from the content-addressed store, hash-verified

113}
114
115export function flattenBy<TNode>(
116 arr: TNode[],
117 getChildren: (item: TNode) => TNode[],
118) {
119 const flat: TNode[] = []
120
121 const recurse = (subArr: TNode[]) => {
122 subArr.forEach((item) => {
123 flat.push(item)
124 const children = getChildren(item)
125 if (children?.length) {
126 recurse(children)
127 }
128 })
129 }
130
131 recurse(arr)
132
133 return flat
134}
135
136export function memo<TDeps extends readonly any[], TDepArgs, TResult>(
137 getDeps: (depArgs?: TDepArgs) => [...TDeps],

Callers 2

groupUpRecursivelyFunction · 0.90
createRowFunction · 0.90

Calls 1

recurseFunction · 0.70

Tested by

no test coverage detected