MCPcopy Create free account
hub / github.com/Effect-TS/effect / transformArrayNested

Function transformArrayNested

packages/effect/src/unstable/sql/Statement.ts:1161–1178  ·  view source on GitHub ↗
(
    rows: ReadonlyArray<A>
  )

Source from the content-addressed store, hash-verified

1159 }
1160
1161 const transformArrayNested = <A extends object>(
1162 rows: ReadonlyArray<A>
1163 ): ReadonlyArray<A> => {
1164 const newRows: Array<A> = new Array(rows.length)
1165 for (let i = 0, len = rows.length; i < len; i++) {
1166 const row = rows[i]
1167 if (Array.isArray(row)) {
1168 newRows[i] = transformArrayNested(row) as any
1169 } else {
1170 const obj: any = {}
1171 for (const [key, value] of Object.entries(row)) {
1172 InternalRecord.assignProperty(obj, transformer(key), transformValue(value))
1173 }
1174 newRows[i] = obj
1175 }
1176 }
1177 return newRows
1178 }
1179
1180 const transformArray = <A extends object>(
1181 rows: ReadonlyArray<A>

Callers

nothing calls this directly

Calls 2

transformerFunction · 0.85
transformValueFunction · 0.85

Tested by

no test coverage detected