Appearance
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:
| Parameter | Type | Description |
|---|---|---|
| array | Array | The input array |
| applyQuotes | bool | true -> 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:
| Parameter | Type | Description |
|---|---|---|
| array | Array | The 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:
| Parameter | Type | Description |
|---|---|---|
| array | Array | The input array |
| regularExpression | Regex | A 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:
| Parameter | Type | Description |
|---|---|---|
| object | Object | The object to search. |
| base | String | The base of the search. This should point to an array inside the target object |
| inside | String | Inside part. This is the path inside the object that should be matched against the supplied value |
| fn | Function | A function that returns true when the object is matched. the input to the function will be the base element in the list being iterated. |
| default | Object | optional 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:
| Parameter | Type | Description |
|---|---|---|
| input | String | The 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:
| Parameter | Type | Description |
|---|---|---|
| start | int | The starting number |
| end | int | The 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:
| Parameter | Type | Description |
|---|---|---|
| object | Object | the value to be compared. |