Reference Source
import Utilities from 'd-theia/src/components/Utilities.js'
public class | source

Utilities

The Utilities object is is a class containing reusable static methods

Static Method Summary

Static Public Methods
public static

Returns a promise resolving with JSON when supplied with a valid URL

public static

getRandomInteger(iMin: Integer, iMax: Integer, iOmit: Integer): Integer

Generates a random integer within a range.

public static

truncateString(sString: String, iMaxLength: Integer): String

Truncates a string and adds ellipsis.

Static Public Methods

public static getPromiseJSON(sUrl: String): * source

Returns a promise resolving with JSON when supplied with a valid URL

Params:

NameTypeAttributeDescription
sUrl String

Required URL to make request

Return:

*

Throw:

Error

invalid api string

public static getRandomInteger(iMin: Integer, iMax: Integer, iOmit: Integer): Integer source

Generates a random integer within a range.

Params:

NameTypeAttributeDescription
iMin Integer

minimum random value

iMax Integer

max random value

iOmit Integer

specify a value to omit from results

Return:

Integer

new random integer

public static truncateString(sString: String, iMaxLength: Integer): String source

Truncates a string and adds ellipsis.

Params:

NameTypeAttributeDescription
sString String

string to be truncated

iMaxLength Integer

max length of string before truncation

Return:

String

truncated string