Skip to main content

@terascope/data-mate / data-frame/utils

data-frame/utils

Functions

buildRecords()

buildRecords<T>(builders, records): [keyof T, Builder<any>][]

Type parameters

Type parameter
T extends Record<string, any>

Parameters

ParameterType
buildersMap<keyof T, Builder<unknown>>
recordsT[]

Returns

[keyof T, Builder<any>][]

Source

data-mate/src/data-frame/utils.ts:9


columnsToBuilderEntries()

columnsToBuilderEntries<T>(columns, size): Iterable<[keyof T, Builder]>

Type parameters

Type parameter
T extends Record<string, unknown>

Parameters

ParameterType
columnsreadonly Column<any, keyof T>[]
sizenumber

Returns

Iterable<[keyof T, Builder]>

Source

data-mate/src/data-frame/utils.ts:84


columnsToDataTypeConfig()

columnsToDataTypeConfig<T>(columns): DataTypeConfig

Type parameters

Type parameter
T extends Record<string, unknown>

Parameters

ParameterType
columnsreadonly Column<unknown, keyof T>[]

Returns

DataTypeConfig

Source

data-mate/src/data-frame/utils.ts:63


concatColumnsToColumns()

concatColumnsToColumns<T>(builders, columns, offset): [keyof T, Builder<any>][]

Type parameters

Type parameter
T extends Record<string, any>

Parameters

ParameterType
buildersMap<keyof T, Builder<any>>
columnsreadonly Column<any, keyof T>[]
offsetnumber

Returns

[keyof T, Builder<any>][]

Source

data-mate/src/data-frame/utils.ts:47


createColumnsWithIndices()

createColumnsWithIndices<T>(columns, indices, size): readonly Column<any, keyof T>[]

Type parameters

Type parameter
T extends Record<string, any>

Parameters

ParameterType
columnsreadonly Column<any, keyof T>[]
indicesIterable<number>
sizenumber

Returns

readonly Column<any, keyof T>[]

Source

data-mate/src/data-frame/utils.ts:118


distributeRowsToColumns()

distributeRowsToColumns<T>(config, records): Column<any, keyof T>[]

Type parameters

Type parameter
T extends Record<string, any>

Parameters

ParameterType
configDataTypeConfig | Readonly<Overwrite<DataTypeConfig, object>>
recordsT[]

Returns

Column<any, keyof T>[]

Source

data-mate/src/data-frame/utils.ts:33


getSortedColumnsByValueCount()

getSortedColumnsByValueCount(_columns): readonly Column<any, any>[]

Sort the columns by likelihood of the values being there, this was initially created to be used in combination with isEmptyRow

Parameters

ParameterType
_columnsreadonly Column<any, any>[]

Returns

readonly Column<any, any>[]

Source

data-mate/src/data-frame/utils.ts:202


indicesFilterIterable()

indicesFilterIterable(n, fn): Iterable<number>

Parameters

ParameterType
nnumber
fn(index) => boolean

Returns

Iterable<number>

Source

data-mate/src/data-frame/utils.ts:140


isEmptyRow()

isEmptyRow(columns, row): boolean

Verify the a column has null fields in a

Parameters

ParameterType
columnsreadonly Column<any, any>[]
rownumber

Returns

boolean

Source

data-mate/src/data-frame/utils.ts:215


makeKeyForRow()

makeKeyForRow<T>(keyAggs, index): object | undefined

Type parameters

Type parameter
T extends Record<string, any>

Parameters

ParameterType
keyAggsMap<keyof T, KeyAggFn>
indexnumber

Returns

object | undefined

Source

data-mate/src/data-frame/utils.ts:167


makeUniqueRowBuilder()

makeUniqueRowBuilder<T>(builders, buckets, getColumnValue): (row, key, index) => void

Type parameters

Type parameter
T extends Record<string, any>

Parameters

ParameterType
buildersMap<keyof T, Builder<any>>
bucketsSet<string>
getColumnValue(name, i) => any

Returns

Function

Parameters
ParameterType
rowPartial<T>
keystring
indexnumber
Returns

void

Source

data-mate/src/data-frame/utils.ts:148


processFieldFilter()

processFieldFilter(indices, column, filter, json): void

Parameters

ParameterType
indicesSet<number>
columnColumn<any, string>
filter(value) => boolean
jsonboolean

Returns

void

Source

data-mate/src/data-frame/utils.ts:102


splitOnNewLineIterator()

splitOnNewLineIterator(data): Iterable<Buffer | string>

Parameters

ParameterType
datastring | Buffer

Returns

Iterable<Buffer | string>

Source

data-mate/src/data-frame/utils.ts:222