Utils
Defined in: src/utils.ts:171
Constructors
Constructor
new Utils():
Utils
Returns
Utils
Methods
createResultsCsv()
staticcreateResultsCsv(resultDF?):string
Defined in: src/utils.ts:395
Parameters
| Parameter | Type |
|---|---|
resultDF? | DataFrame |
Returns
string
detectColumnHierarchy()
staticdetectColumnHierarchy(columns,maxDepth?):string[]
Defined in: src/utils.ts:391
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
| Parameter | Type | Default value | Description |
|---|---|---|---|
columns | Column<any, any>[] | undefined | List of columns to detect hierarchy in. |
maxDepth | number | 3 | Maximum depth of the hierarchy to detect. |
Returns
string[]
download()
staticdownload(filename,content,contentType?):void
Defined in: src/utils.ts:230
Downloads the specified content locally
Parameters
| Parameter | Type |
|---|---|
filename | string |
content | BlobPart |
contentType? | string |
Returns
void
executeTests()
staticexecuteTests(testsParams,stopOnFail?):Promise<any>
Defined in: src/utils.ts:289
Parameters
| Parameter | Type |
|---|---|
testsParams | object[] |
stopOnFail? | boolean |
Returns
Promise<any>
firstOrNull()
staticfirstOrNull<T>(iterable):T|null
Defined in: src/utils.ts:173
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
iterable | Iterable<T> | - |
Returns
T | null
getJsonValueType()
staticgetJsonValueType(x):"string"|"bigint"|"object"|"int"|"double"|"bool"|"byte_array"|"datetime"|"qnum"|"dataframe"|null
Defined in: src/utils.ts:260
Parameters
| Parameter | Type |
|---|---|
x | any |
Returns
"string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe" | null
identity()
staticidentity(length):Uint32Array<ArrayBuffer>
Defined in: src/utils.ts:179
Returns an 'identity' array where the element in idx-th position is equals to idx.
Parameters
| Parameter | Type |
|---|---|
length | number |
Returns
Uint32Array<ArrayBuffer>
isEmpty()
staticisEmpty(s?):boolean
Defined in: src/utils.ts:195
Parameters
| Parameter | Type |
|---|---|
s? | string |
Returns
boolean
jsonToColumns()
staticjsonToColumns(column):void
Defined in: src/utils.ts:274
Expands a column of JSON strings into multiple columns, one per unique key
Parameters
| Parameter | Type |
|---|---|
column | Column<string> |
Returns
void
loadJsCss()
staticloadJsCss(files):Promise<null>
Defined in: src/utils.ts:243
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
| Parameter | Type |
|---|---|
files | string[] |
Returns
Promise<null>
nullIfEmpty()
staticnullIfEmpty(s?):string|null|undefined
Defined in: src/utils.ts:199
Parameters
| Parameter | Type |
|---|---|
s? | string |
Returns
string | null | undefined
openFile()
staticopenFile(options):void
Defined in: src/utils.ts:204
Shows "Open File" dialog, and lets you process the result.
Parameters
| Parameter | Type |
|---|---|
options | { accept: string; open: (file) => void; } |
options.accept | string |
options.open | (file) => void |
Returns
void
openFileBytes()
staticopenFileBytes(options):void
Defined in: src/utils.ts:216
Shows "Open File" dialog, and lets you process the result.
Parameters
| Parameter | Type |
|---|---|
options | { accept: string; open: (bytes) => void; } |
options.accept | string |
options.open | (bytes) => void |
Returns
void
random()
staticrandom<T>(items):T
Defined in: src/utils.ts:187
Returns random element from the array. Useful for demo data, tests, etc.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
items | T[] |
Returns
T
randomString()
staticrandomString(length):string
Defined in: src/utils.ts:410
Parameters
| Parameter | Type |
|---|---|
length | number |
Returns
string
replaceAll()
staticreplaceAll(string,search,replace):string
Defined in: src/utils.ts:191
Parameters
| Parameter | Type |
|---|---|
string | string |
search | string |
replace | string |
Returns
string
streamToObservable()
staticstreamToObservable<T>(dartStream):Observable<T>
Defined in: src/utils.ts:247
Type Parameters
| Type Parameter | Default type |
|---|---|
T | any |
Parameters
| Parameter | Type |
|---|---|
dartStream | any |
Returns
Observable<T>