MCPcopy Create free account
hub / github.com/Shazbot/WH3-Mod-Manager / chunkSchemaIntoRows

Function chunkSchemaIntoRows

src/packFileSerializer.ts:697–708  ·  view source on GitHub ↗
(schemaFields: SchemaField[], dbversion: DBVersion)

Source from the content-addressed store, hash-verified

695 return getDBVersionByTableName(packFile, dbName);
696};
697export const chunkSchemaIntoRows = (schemaFields: SchemaField[], dbversion: DBVersion) => {
698 return (
699 schemaFields?.reduce<SchemaField[][]>((resultArray, item, index) => {
700 const chunkIndex = Math.floor(index / dbversion.fields.length);
701 if (!resultArray[chunkIndex]) {
702 resultArray[chunkIndex] = []; // start a new chunk
703 }
704 resultArray[chunkIndex].push(item as SchemaField);
705 return resultArray;
706 }, []) ?? []
707 );
708};
709export const resolveKeyValue = (field_type: SCHEMA_FIELD_TYPE, fields: Field[]) => {
710 if (isSchemaFieldNumber(field_type)) {
711 return isSchemaFieldNumberInteger(field_type)

Callers 13

buildDBReferenceTreeFunction · 0.90
addRefsRecursivelyFunction · 0.90
addNewCellFromReferenceFunction · 0.90
getRowsForPackedFileFunction · 0.90
executeDBDuplicationFunction · 0.90
getRowsForPackedFileFunction · 0.90
getTableRowDataFunction · 0.90
findPackTableReferencesFunction · 0.90
amendSchemaFieldFunction · 0.85
getPacksTableDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected