Constructor
new module:br-util /Array Utility()
This is a static class that never needs to be instantiated.
Methods
(static) in Array(array ToSearch, value ToFind) → {Boolean}
Return true if the input array contains the input value, false otherwise.
Parameters:
| Name | Type | Description |
|---|---|---|
arrayToSearch |
Array | The Array to test for the presence of the input variant. May not be null or undefined. |
valueToFind |
Variant | Variant whose presence in the input array is to be tested. Works with null, undefined and NaN. |
Returns:
true if the specified value was found in the array, false otherwise.
- Type
- Boolean
(static) remove Item(array ToRemove From, value ToRemove) → {Array}
Removes the first example of the specified item in the specified array, or does nothing if the item is not found.
Since this method uses the built-in indexOf which does work with NaN, it will not work
if called with NaN and will throw an InvalidParametersError. If you need to remove NaN, you'll have
to loop over the array and then splice it out.
Parameters:
| Name | Type | Description |
|---|---|---|
arrayToRemoveFrom |
Array | The Array from which to remove the specified item. May not be null or undefined. |
valueToRemove |
Variant | The Variant to be removed from the specified array. May not be NaN. |
Returns:
The input array with the specified item removed, or the original array if the item was not found.
- Type
- Array