MCPcopy Index your code
hub / github.com/microsoft/SandDance / getColumnsFromData

Function getColumnsFromData

packages/sanddance-specs/src/inference.ts:20–33  ·  view source on GitHub ↗
(inferTypesFn: typeof inferTypes, data: object[], columnTypes?: ColumnTypeMap)

Source from the content-addressed store, hash-verified

18 * @param data Array of data objects.
19 */
20export function getColumnsFromData(inferTypesFn: typeof inferTypes, data: object[], columnTypes?: ColumnTypeMap) {
21 const sample = data[0];
22 const fields = sample ? Object.keys(sample) : [];
23 const inferences = { ...inferTypesFn(data, fields), ...columnTypes };
24 const columns = fields.map(name => {
25 const column: Column = {
26 name,
27 type: inferences[name],
28 };
29 return column;
30 });
31 inferAll(columns, data);
32 return columns;
33}
34
35/**
36 * Get columns associated with each Insight role.

Callers 1

getColumnsMethod · 0.90

Calls 1

inferAllFunction · 0.70

Tested by

no test coverage detected