refactor(csv-loader): simplify module generation logic

Update the code generation in `csvToModule` to use a more concise
mapping pattern for row resolvers, removing the unnecessary object
spread and nested braces.
This commit is contained in:
hypercross 2026-04-20 15:49:41 +08:00
parent 3e768f5c83
commit 89ac1619e7
1 changed files with 3 additions and 4 deletions

View File

@ -233,10 +233,9 @@ export function csvToModule(
...reverseLookupInits.map((l) => ` ${l}`),
...(rowResolvers.length > 0
? [
" _resolved = _raw.map(row => ({",
" ...row,",
...rowResolvers,
" }));",
" _resolved = _raw.map(row => (",
...rowResolvers.map((r) => ` row${r.slice(1)}`),
" row));",
]
: []),
" return _resolved;",