Skip to content

X

A collection of utility functions.

Static Methods

asCommaString(array, applyQuotes) → String

Given a list of items, convert it to a comma-separated string. Strings are quoted, numbers are not.

Returns: String - A comma-separated list

Parameters:

ParameterTypeDescription
arrayArrayThe input array
applyQuotesbooltrue -> force quotes on all objects. False if not supplied.

levelArray(array) → Array

Given an array containing elements and other arrays, return an array of only elements, flatening each sub-array. Duplicate elements are removed.

Returns: Array - An array of elements

Parameters:

ParameterTypeDescription
arrayArrayThe input array

filterList(array, regularExpression) → Array

Create a new list from an existing list where each member matches the specified regular expression.

Returns: Array - An array of elements matching the given regex

Parameters:

ParameterTypeDescription
arrayArrayThe input array
regularExpressionRegexA regular expression used to filter the list

findIn(object, base, inside, fn, default) → Object

Return an object by executing a search inside a larger object.

Returns: Object - The first matching object.

Parameters:

ParameterTypeDescription
objectObjectThe object to search.
baseStringThe base of the search. This should point to an array inside the target object
insideStringInside part. This is the path inside the object that should be matched against the supplied value
fnFunctionA function that returns true when the object is matched. the input to the function will be the base element in the list being iterated.
defaultObjectoptional default value.

versionNumber(input) → int

Return a situate version number from a version number string. For example, situate-1.11.1 will return 11101

Returns: int - A version number

Parameters:

ParameterTypeDescription
inputStringThe input string

range(start, end) → Array

Return a list of integer elements from the staring number up to and including the ending number

Returns: Array - The Array of numbers

Parameters:

ParameterTypeDescription
startintThe starting number
endintThe ending number

sqlEquals(object) → String

Aids in generating queries. Returns "IS NULL" if the argument is null or "= <value>" if the value is not null. If value is a string, proper quotes are also added.

Returns: String - The expanded result

Parameters:

ParameterTypeDescription
objectObjectthe value to be compared.

Workload Automation and Orchestration