Contains all the utility methods for custom scripting
- Source:
Methods
-
.cleanArray(options)
-
This function removes items from an array. Typically used for removing empty items.
Parameters:
Name Type Description options
Object Specify the options for this method.
Properties
Name Type Description array
* Specify the array to clean.
valueToRemove
* Specify the value to remove from the array.
- Source:
Returns:
Returns a cleaned array. Items that equaled the provided value to remove are no longer in the array.
- Type
- *
-
.format(options)
-
This function formats the specified text to add dynamic arguments. The string can contain placeholders like C#: {0}, {1}, ...
Parameters:
Name Type Description options
Object Specify the options for this method.
Properties
Name Type Description text
String Specify the unformatted string.
values
* Specify an array of values. The item at index 0 will replace {0} and so on.
- Source:
Returns:
Returns the formatted string.
- Type
- String
-
.getDescendantProp(options)
-
This function searches an object for a property based on a dot notation.
Parameters:
Name Type Description options
Object Specify the options for this method.
Properties
Name Type Description data
Object Specify the object to look in.
property
string Specify the property you want to receive the value from. This is specified in a dot notation like a normal JavaScript object.
- Source:
Returns:
REturns the value of the property or undefined if nothing was found.
-
.getFile(options)
-
This function receives the url of a file and tries to get the file with the $http service from Angular. The file contents are returned in the response.
Parameters:
Name Type Description options
Object Specify the options for this method.
Properties
Name Type Description url
* Specify the url of the file.
cache
bool Specify if you want to cache the file in the session storage. If the file is large (> 50 000 bytes) we do not recommend it to cache the file.
- Source:
Returns:
Returns a promise for receiving the file.
- Type
- Promise
-
.getRestUrl()
-
Returns the current REST Service url from the utility service.
- Source:
Returns:
Returns the current REST Service url.
- Type
- String
-
.isDefined(options)
-
This function checks whether the passed variable is defined. A variable is defined when it's not undefined or null.
Parameters:
Name Type Description options
Object Specify the options for this method.
Properties
Name Type Description variable
* Specify the variable you want to check.
- Source:
Returns:
Returns a boolean indicating whether the variable is defined.
- Type
- Boolean
-
.isUndefined(options)
-
This function checks whether the passed variable is undefined. Shorthand version for a typeof check.
Parameters:
Name Type Description options
Object Specify the options for this method.
Properties
Name Type Description variable
* Specify the variable you want to check.
- Source:
Returns:
Returns a boolean indicating whether the variable is undefined.
- Type
- Boolean
-
.isUndefinedOrEmpty(options)
-
This function checks whether the passed variable is undefined or empty. A variable is empty when it is null or an empty string.
Parameters:
Name Type Description options
Object Specify the options for this method.
Properties
Name Type Description variable
* Specify the variable you want to check.
- Source:
Returns:
Returns a boolean indicating whether the variable is undefined or empty.
- Type
- Boolean
-
.randomString(options)
-
This function creates a random string for a given amount of characters. By default, 5 characters are used.
Parameters:
Name Type Description options
Object Specify the options for this method.
Properties
Name Type Description stringLength
Integer Specify the amount of characters to use.
- Source:
Returns:
Returns the randomly generated string.
- Type
- String