A set of utility functions for working with arrays.
Node | Description |
---|
Method | Description |
---|---|
sap.ui.vtm.ArrayUtilities.areEqual |
Returns |
sap.ui.vtm.ArrayUtilities.deepClone |
Creates a copy of an array in which the items are cloned. |
sap.ui.vtm.ArrayUtilities.find |
Returns the first item in an array that matches the supplied predicate or returns undefined if no match is found. |
sap.ui.vtm.ArrayUtilities.findIndex |
Returns the index of the first item in an array that matches the supplied predicate or returns -1 if no match is found. |
sap.ui.vtm.ArrayUtilities.flatten |
Flattens an array of arrays down to an array. |
sap.ui.vtm.ArrayUtilities.fromArrayLike |
Converts from an array-like object (an object that supports indexing and has a length) to an array. |
sap.ui.vtm.ArrayUtilities.fromSet |
Converts an ES6 Set to an array. |
sap.ui.vtm.ArrayUtilities.haveIntersection |
Returns whether a group of arrays have a non empty set intersection. |
sap.ui.vtm.ArrayUtilities.intersect |
Returns the set intersection of a group of arrays. |
sap.ui.vtm.ArrayUtilities.shallowClone |
Creates a copy of an array in which the items are copied by reference rather than being cloned. |
sap.ui.vtm.ArrayUtilities.toSet |
Converts an array to an ES6 Set. |
sap.ui.vtm.ArrayUtilities.union |
Returns the set union (as an array) of a group of arrays. |
sap.ui.vtm.ArrayUtilities.unwrap |
The inverse of sap.ui.vtm.ArrayUtilities.wrap.
|
sap.ui.vtm.ArrayUtilities.wrap |
Wraps an item in an array if it is not already an array.
|
Returns true
if a group of arrays are equal.
Param | Type | DefaultValue | Description |
---|---|---|---|
arrayOfArrays | Array |
The array of arrays to compare. |
|
equalityFunc | function |
A function that takes two parameters and returns a boolean value indicating whether the parameter values are equal. |
Creates a copy of an array in which the items are cloned.
Param | Type | DefaultValue | Description |
---|---|---|---|
array | Array |
The array to clone. |
|
itemCloneFunc | function |
A function used to clone an item of the array. The function has an argument that takes an item of the type stored in the array and returns an item of the same type. |
Returns the first item in an array that matches the supplied predicate or returns undefined if no match is found.
Param | Type | DefaultValue | Description |
---|---|---|---|
array | Array |
The array to search. |
|
predicate | function |
A function that takes a value of the type stored in the array and returns a boolean value (true if the item is a match. |
Returns the index of the first item in an array that matches the supplied predicate or returns -1 if no match is found.
Param | Type | DefaultValue | Description |
---|---|---|---|
array | Array |
The array to search. |
|
predicate | function |
A function that takes a value of the type stored in the array and returns a boolean value (true if the item is a match. |
Flattens an array of arrays down to an array.
Param | Type | DefaultValue | Description |
---|---|---|---|
arrayOfArrays | Array |
An array of arrays. |
Converts from an array-like object (an object that supports indexing and has a length) to an array.
Param | Type | DefaultValue | Description |
---|---|---|---|
arrayLike | object |
The array-like object to convert to an array. |
Converts an ES6 Set to an array.
Param | Type | DefaultValue | Description |
---|---|---|---|
set | Set |
The Set to convert to an array. |
Returns whether a group of arrays have a non empty set intersection.
Param | Type | DefaultValue | Description |
---|---|---|---|
arrayOfArrays | Array |
An array of arrays to check for the existence of a set intersection. |
|
equalityFunction | function |
A function that returns a Boolean value to compare values within arrays. When not specified, strict equality ( |
Returns the set intersection of a group of arrays.
Param | Type | DefaultValue | Description |
---|---|---|---|
arrayOfArrays | Array |
An array of arrays to to find the set intersection of. |
|
equalityFunction | function |
A function that returns a Boolean value to compare values within arrays. When not specified, strict equality ( |
Creates a copy of an array in which the items are copied by reference rather than being cloned.
Param | Type | DefaultValue | Description |
---|---|---|---|
array | Array |
The array to clone. |
Converts an array to an ES6 Set.
Param | Type | DefaultValue | Description |
---|---|---|---|
array | Array |
The array to convert to a Set. |
Returns the set union (as an array) of a group of arrays.
Param | Type | DefaultValue | Description |
---|---|---|---|
arrayOfArrays | Array |
An array of arrays to find the set union of. |
|
equalityFunction | function |
A function that returns a Boolean value to compare values within arrays. When not specified, strict equality ( |
The inverse of sap.ui.vtm.ArrayUtilities.wrap.
undefined
is returned.Param | Type | DefaultValue | Description |
---|---|---|---|
item | any |
The item to unwrap. |
Wraps an item in an array if it is not already an array.
undefined
an empty array is returned.Param | Type | DefaultValue | Description |
---|---|---|---|
item | any |
The item to wrap as an array if it is not already an array. |