new DataUtils()
Class containing utility functions for use with arrays
- Source:
Methods
array_mDimSort(pArray, pIndex, pUp, isNumber)
sorts a two dim array by the given index
Parameters:
Name | Type | Description |
---|---|---|
pArray |
Array | req the Array to be sorted |
pIndex |
String | req the index of the field to sort by |
pUp |
Boolean | req TRUE sorts ascending, FALSE sorts decending |
isNumber |
Boolean | TRUE sorts numerical, FALSE or undefined sorts alphanumerical |
- Source:
Throws:
-
if index is outside pArray.length
- Type
- Error
Returns:
void
concatArrayColumns(pArray1, pArrayN) → {Array}
concats arrays column by column
see example for more details
logging.show(JSON.stringify(concatArrayColumns(a, b)));
//[["a","A"],["b","B"],["c","C"]]
logging.show(JSON.stringify(a.concat(b)));
//["a","b","c","A","B","C"]
Parameters:
Name | Type | Description |
---|---|---|
pArray1 |
Array | req you have to pass at least 2 Arrays that shall be concated but you can pass as many as you want |
pArrayN |
Array | req you have to pass at least 2 Arrays that shall be concated but you can pass as many as you want |
- Source:
Returns:
Beschreibung
- Type
- Array
hasElement(pArray, pElement, pIgnoreCase) → {Boolean}
returns if an element is in an array.
Parameters:
Name | Type | Description |
---|---|---|
pArray |
Array | req array which should be searched in |
pElement |
String | req Element which should looked for |
pIgnoreCase |
Boolean | opt |
- Source:
Returns:
true if it has the element
- Type
- Boolean
isArray(pArray) → {Boolean}
function to determine, if an object is truly an Array
Parameters:
Name | Type | Description |
---|---|---|
pArray |
Object |
- Source:
Returns:
returns wether an Object is an Array (true) or not (false)
- Type
- Boolean
notIn(pSource, pReference, pIgnoreCase) → {Array.<Array>}
returns all elemtens not in pSource
Parameters:
Name | Type | Description |
---|---|---|
pSource |
Array | req this elements are being searched |
pReference |
Array | req in this array the search is done |
pIgnoreCase |
Boolean | opt |
- Source:
Returns:
resultIn
- Type
- Array.<Array>
removeElement(pArray, pElement) → {Array}
removes an element from an array
Parameters:
Name | Type | Description |
---|---|---|
pArray |
Array | req Array from which the element should be removed |
pElement |
String | req index of the element which should be removed |
- Source:
Returns:
array without the removed element
- Type
- Array
sortArray(pArray, us, u, vs, v, ws, w, xs, x, ys, y, zs, z) → {void}
sorts an array up to 6 columns with sortorder
Parameters:
Name | Type | Description |
---|---|---|
pArray |
Array | req the array with data |
us |
Integer | req the Sortorder for Column 1 = Param u (1=asc, -1=desc) |
u |
Integer | req the 1 Column |
vs |
Integer | opt the Sortorder for Column 2 = Param v (1=asc, -1=desc) |
v |
Integer | opt the 2 Column |
ws |
Integer | opt the Sortorder for Column 3 = Param w (1=asc, -1=desc) |
w |
Integer | opt the 3 Column |
xs |
Integer | opt the Sortorder for Column 4 = Param x (1=asc, -1=desc) |
x |
Integer | opt the 4 Column |
ys |
Integer | opt the Sortorder for Column 5 = Param y (1=asc, -1=desc) |
y |
Integer | opt the 5 Column |
zs |
Integer | opt the Sortorder for Column 6 = Param z (1=asc, -1=desc) |
z |
Integer | opt the 6 Column |
- Source:
Returns:
- Type
- void