Skip to main content

Utils

Constructors

new Utils()

new Utils(): Utils

Returns

Utils

Methods

createResultsCsv()

static createResultsCsv(resultDF?): string

Parameters

ParameterType
resultDF?DataFrame

Returns

string

Source

src/utils.ts:397


detectColumnHierarchy()

static detectColumnHierarchy(columns, maxDepth): string[]

Detects natural hierarchy in the list of categorical columns based on their values. Mind that the function can be n^2 in the worst case scenario, although in most cases, it is quite fast as it exits early if missmatch is found.

Parameters

ParameterTypeDefault valueDescription
columnsColumn<any, any>[]undefinedList of columns to detect hierarchy in.
maxDepthnumber3Maximum depth of the hierarchy to detect.

Returns

string[]

Source

src/utils.ts:393


download()

static download(filename, content, contentType?): void

Downloads the specified content locally

Parameters

ParameterType
filenamestring
contentBlobPart
contentType?string

Returns

void

Source

src/utils.ts:231


executeTests()

static executeTests(testsParams, stopOnFail?): Promise<any>

Parameters

ParameterType
testsParamsobject[]
stopOnFail?boolean

Returns

Promise<any>

Source

src/utils.ts:290


firstOrNull()

static firstOrNull<T>(iterable): null | T

Type parameters

Type parameter
T

Parameters

ParameterTypeDescription
iterableIterable<T>

Returns

null | T

Source

src/utils.ts:174


getJsonValueType()

static getJsonValueType(x): null | "string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe"

Parameters

ParameterType
xany

Returns

null | "string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe"

Source

src/utils.ts:261


identity()

static identity(length): Uint32Array

Returns an 'identity' array where the element in idx-th position is equals to idx.

Parameters

ParameterType
lengthnumber

Returns

Uint32Array

Source

src/utils.ts:180


isEmpty()

static isEmpty(s?): boolean

Parameters

ParameterType
s?string

Returns

boolean

Source

src/utils.ts:196


jsonToColumns()

static jsonToColumns(column): void

Expands a column of JSON strings into multiple columns, one per unique key

Parameters

ParameterType
columnColumn<string, string>

Returns

void

Source

src/utils.ts:275


loadJsCss()

static loadJsCss(files): Promise<null>

Loads the specified common libraries, if they were not loaded already. Use it in plugins when a big JS dependency is used infrequently, such as exporting to Excel, or showing a 3d structure. Example: loadJsCss(['common/exceljs.min.js', 'common/exceljs.min.css'])

Parameters

ParameterType
filesstring[]

Returns

Promise<null>

Source

src/utils.ts:244


nullIfEmpty()

static nullIfEmpty(s?): undefined | null | string

Parameters

ParameterType
s?string

Returns

undefined | null | string

Source

src/utils.ts:200


openFile()

static openFile(options): void

Shows "Open File" dialog, and lets you process the result.

Parameters

ParameterType
optionsobject
options.acceptstring
options.open(file) => void

Returns

void

Source

src/utils.ts:205


openFileBytes()

static openFileBytes(options): void

Shows "Open File" dialog, and lets you process the result.

Parameters

ParameterType
optionsobject
options.acceptstring
options.open(bytes) => void

Returns

void

Source

src/utils.ts:217


random()

static random<T>(items): T

Returns random element from the array. Useful for demo data, tests, etc.

Type parameters

Type parameter
T

Parameters

ParameterType
itemsT[]

Returns

T

Source

src/utils.ts:188


randomString()

static randomString(length): string

Parameters

ParameterType
lengthnumber

Returns

string

Source

src/utils.ts:412


replaceAll()

static replaceAll(string, search, replace): string

Parameters

ParameterType
stringstring
searchstring
replacestring

Returns

string

Source

src/utils.ts:192


streamToObservable()

static streamToObservable<T>(dartStream): Observable<T>

Type parameters

Type parameterValue
Tany

Parameters

ParameterType
dartStreamany

Returns

Observable<T>

Source

src/utils.ts:248