@terascope/data-mate / data-frame/utils
data-frame/utils
Functions
buildRecords()
buildRecords<
T
>(builders
,records
): [keyofT
,Builder
<any
>][]
Type parameters
Type parameter |
---|
T extends Record <string , any > |
Parameters
Parameter | Type |
---|---|
builders | Map <keyof T , Builder <unknown >> |
records | T [] |
Returns
[keyof T
, Builder
<any
>][]
Source
data-mate/src/data-frame/utils.ts:9
columnsToBuilderEntries()
columnsToBuilderEntries<
T
>(columns
,size
):Iterable
<[keyofT
,Builder
]>
Type parameters
Type parameter |
---|
T extends Record <string , unknown > |
Parameters
Parameter | Type |
---|---|
columns | readonly Column <any , keyof T >[] |
size | number |
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
Parameter | Type |
---|---|
columns | readonly Column <unknown , keyof T >[] |
Returns
DataTypeConfig
Source
data-mate/src/data-frame/utils.ts:63
concatColumnsToColumns()
concatColumnsToColumns<
T
>(builders
,columns
,offset
): [keyofT
,Builder
<any
>][]
Type parameters
Type parameter |
---|
T extends Record <string , any > |
Parameters
Parameter | Type |
---|---|
builders | Map <keyof T , Builder <any >> |
columns | readonly Column <any , keyof T >[] |
offset | number |
Returns
[keyof T
, Builder
<any
>][]
Source
data-mate/src/data-frame/utils.ts:47
createColumnsWithIndices()
createColumnsWithIndices<
T
>(columns
,indices
,size
): readonlyColumn
<any
, keyofT
>[]
Type parameters
Type parameter |
---|
T extends Record <string , any > |
Parameters
Parameter | Type |
---|---|
columns | readonly Column <any , keyof T >[] |
indices | Iterable <number > |
size | number |
Returns
readonly Column
<any
, keyof T
>[]
Source
data-mate/src/data-frame/utils.ts:118
distributeRowsToColumns()
distributeRowsToColumns<
T
>(config
,records
):Column
<any
, keyofT
>[]
Type parameters
Type parameter |
---|
T extends Record <string , any > |
Parameters
Parameter | Type |
---|---|
config | DataTypeConfig | Readonly <Overwrite <DataTypeConfig , object >> |
records | T [] |
Returns
Column
<any
, keyof T
>[]
Source
data-mate/src/data-frame/utils.ts:33
getSortedColumnsByValueCount()
getSortedColumnsByValueCount(
_columns
): readonlyColumn
<any
,any
>[]
Sort the columns by likelihood of the values being there, this was initially created to be used in combination with isEmptyRow
Parameters
Parameter | Type |
---|---|
_columns | readonly Column <any , any >[] |
Returns
readonly Column
<any
, any
>[]
Source
data-mate/src/data-frame/utils.ts:202
indicesFilterIterable()
indicesFilterIterable(
n
,fn
):Iterable
<number
>
Parameters
Parameter | Type |
---|---|
n | number |
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
Parameter | Type |
---|---|
columns | readonly Column <any , any >[] |
row | number |
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
Parameter | Type |
---|---|
keyAggs | Map <keyof T , KeyAggFn > |
index | number |
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
Parameter | Type |
---|---|
builders | Map <keyof T , Builder <any >> |
buckets | Set <string > |
getColumnValue | (name , i ) => any |
Returns
Function
Parameters
Parameter | Type |
---|---|
row | Partial <T > |
key | string |
index | number |
Returns
void
Source
data-mate/src/data-frame/utils.ts:148
processFieldFilter()
processFieldFilter(
indices
,column
,filter
,json
):void
Parameters
Parameter | Type |
---|---|
indices | Set <number > |
column | Column <any , string > |
filter | (value ) => boolean |
json | boolean |
Returns
void
Source
data-mate/src/data-frame/utils.ts:102
splitOnNewLineIterator()
splitOnNewLineIterator(
data
):Iterable
<Buffer
|string
>
Parameters
Parameter | Type |
---|---|
data | string | Buffer |
Returns
Iterable
<Buffer
| string
>