MCPcopy
hub / github.com/ThatGuySam/doesitarm / loadGamesSnapshot

Function loadGamesSnapshot

helpers/build-game-list.js:141–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

139}
140
141export async function loadGamesSnapshot () {
142 const csv = await fs.readFile( gamesSnapshotCsvPath, 'utf8' )
143 const rows = parseCsvRows( csv )
144 const headerRowIndex = findGamesHeaderRowIndex( rows )
145
146 if ( headerRowIndex === -1 ) {
147 throw new Error( `Could not find Games header row in ${ gamesSnapshotCsvPath }` )
148 }
149
150 const headers = rows[ headerRowIndex ]
151
152 return rows
153 .slice( headerRowIndex + 1 )
154 .filter( row => !isBlankRow( row ) )
155 .filter( row => row[ 0 ]?.trim().length > 0 )
156 .map( row => mapCsvRowToRecord( headers, row ) )
157}
158
159export default async function () {
160

Callers 1

build-game-list.jsFile · 0.85

Calls 5

parseCsvRowsFunction · 0.85
findGamesHeaderRowIndexFunction · 0.85
isBlankRowFunction · 0.85
mapCsvRowToRecordFunction · 0.85
readFileMethod · 0.80

Tested by

no test coverage detected