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

Function getColumnIndexForPackedFile

src/nodeExecutor.ts:84–107  ·  view source on GitHub ↗
(
  packedFile: Pick<PackedFile, "tableSchema">,
  columnName: string,
  executionContext?: FlowExecutionContext,
)

Source from the content-addressed store, hash-verified

82};
83
84const getColumnIndexForPackedFile = (
85 packedFile: Pick<PackedFile, "tableSchema">,
86 columnName: string,
87 executionContext?: FlowExecutionContext,
88): number => {
89 if (!packedFile.tableSchema) {
90 return -1;
91 }
92
93 if (!executionContext) {
94 return packedFile.tableSchema.fields.findIndex((field) => field.name === columnName);
95 }
96
97 let columnIndexes = executionContext.columnIndexesByPackedFile.get(packedFile as PackedFile);
98 if (!columnIndexes) {
99 columnIndexes = new Map<string, number>();
100 packedFile.tableSchema.fields.forEach((field, index) => {
101 columnIndexes?.set(field.name, index);
102 });
103 executionContext.columnIndexesByPackedFile.set(packedFile as PackedFile, columnIndexes);
104 }
105
106 return columnIndexes.get(columnName) ?? -1;
107};
108
109const readPackCached = async (
110 packPath: string,

Callers 2

executeLookupNodeFunction · 0.70

Calls 1

getMethod · 0.65

Tested by

no test coverage detected