Utils
Constructors
new Utils()
new Utils():
Utils
Returns
Methods
createResultsCsv()
staticcreateResultsCsv(resultDF?):string
Parameters
| Parameter | Type |
|---|---|
resultDF? | DataFrame |
Returns
string
Source
detectColumnHierarchy()
staticdetectColumnHierarchy(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
| 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[]
Source
download()
staticdownload(filename,content,contentType?):void
Downloads the specified content locally
Parameters
| Parameter | Type |
|---|---|
filename | string |
content | BlobPart |
contentType? | string |
Returns
void
Source
executeTests()
staticexecuteTests(testsParams,stopOnFail?):Promise<any>
Parameters
| Parameter | Type |
|---|---|
testsParams | object[] |
stopOnFail? | boolean |
Returns
Promise<any>
Source
firstOrNull()
staticfirstOrNull<T>(iterable):null|T
Type parameters
| Type parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
iterable | Iterable<T> |
Returns
null | T
Source
getJsonValueType()
staticgetJsonValueType(x):null|"string"|"bigint"|"object"|"int"|"double"|"bool"|"byte_array"|"datetime"|"qnum"|"dataframe"
Parameters
| Parameter | Type |
|---|---|
x | any |
Returns
null | "string" | "bigint" | "object" | "int" | "double" | "bool" | "byte_array" | "datetime" | "qnum" | "dataframe"
Source
identity()
staticidentity(length):Uint32Array
Returns an 'identity' array where the element in idx-th position is equals to idx.
Parameters
| Parameter | Type |
|---|---|
length | number |
Returns
Uint32Array
Source
isEmpty()
staticisEmpty(s?):boolean
Parameters
| Parameter | Type |
|---|---|
s? | string |
Returns
boolean
Source
jsonToColumns()
staticjsonToColumns(column):void
Expands a column of JSON strings into multiple columns, one per unique key
Parameters
| Parameter | Type |
|---|---|
column | Column<string, string> |
Returns
void
Source
loadJsCss()
staticloadJsCss(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
| Parameter | Type |
|---|---|
files | string[] |
Returns
Promise<null>
Source
nullIfEmpty()
staticnullIfEmpty(s?):undefined|null|string
Parameters
| Parameter | Type |
|---|---|
s? | string |
Returns
undefined | null | string
Source
openFile()
staticopenFile(options):void
Shows "Open File" dialog, and lets you process the result.
Parameters
| Parameter | Type |
|---|---|
options | object |
options.accept | string |
options.open | (file) => void |
Returns
void
Source
openFileBytes()
staticopenFileBytes(options):void
Shows "Open File" dialog, and lets you process the result.
Parameters
| Parameter | Type |
|---|---|
options | object |
options.accept | string |
options.open | (bytes) => void |
Returns
void
Source
random()
staticrandom<T>(items):T
Returns random element from the array. Useful for demo data, tests, etc.
Type parameters
| Type parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
items | T[] |
Returns
T
Source
randomString()
staticrandomString(length):string
Parameters
| Parameter | Type |
|---|---|
length | number |
Returns
string
Source
replaceAll()
staticreplaceAll(string,search,replace):string
Parameters
| Parameter | Type |
|---|---|
string | string |
search | string |
replace | string |
Returns
string
Source
streamToObservable()
staticstreamToObservable<T>(dartStream):Observable<T>
Type parameters
| Type parameter | Value |
|---|---|
T | any |
Parameters
| Parameter | Type |
|---|---|
dartStream | any |
Returns
Observable<T>