OlapicUtils
A list of utlity methods for the DevKit library.
Static Method Summary
Static Public Methods | ||
public static |
assignToString(string: string, assigments: Object): string Assign a list of parameters to a string with placeholders. |
|
public static |
rejectedPromise(response: *): Promise<null, *> Returns an already rejected promise. |
|
public static |
resolvedPromise(response: *): Promise<*, null> Returns an already resolved promise. |
Static Public Methods
public static assignToString(string: string, assigments: Object): string source
Assign a list of parameters to a string with placeholders.
Example:
// It will return 'Hello world'
OlapicUtils.assignToString('Hello {target}', { target: 'world' });
public static rejectedPromise(response: *): Promise<null, *> source
Returns an already rejected promise.
Params:
Name | Type | Attribute | Description |
response | * | The object to send to the |
Example:
OlapicUtils.rejectedPromise('error message').catch((e) => {
// It will log 'error message'
console.log(e);
});
public static resolvedPromise(response: *): Promise<*, null> source
Returns an already resolved promise.
Params:
Name | Type | Attribute | Description |
response | * | The object to send to the |
Example:
OlapicUtils.rejectedPromise('hello world').then((message) => {
// It will log 'hello world'
console.log(message);
});