![]() | Force-FrameworkMark Brennand |
Description | Copyright (c) 2025 Mark Brennand, released under MIT License. Class providing the Array API. See README for full details of the Array API. |
---|---|
Author | Mark Brennand |
Description | Creates the iterator for an array of objects. The method to iterate the array with may then be called. If data is to be shared between callbacks, call the shared() method before the iterator method. |
---|---|
Parameter | objects: The array of objects to be iterated. |
Returns | The methods that may be called on the array. |
Description | Exception thrown when an operation in the Array API fails. |
---|
Description | Class representing a callback to process each iterated array element. The function() method must be overridden to code the logic to be performed on the array element. Data shared on initiation of the iterator is accessed using the shared() method. |
---|
Description | This class must be extended to code the logic to be performed on each array element. The method will be called for each element. The currentValue will be null, except when the callback is being called from the reduce() method. In this case, its value will be the accumulated result of all the previous callbacks. See the iterator methods for details of the return values expected from the callback. |
---|---|
Parameter | element: The current array element. |
Parameter | currentValue: The value accumulated over the array iteration. |
Parameter | index: The positional index of the array element. |
Returns | A value representing the result of the processing. |
Description | Returns the shared data for the callback. |
---|---|
Returns | The shared data. |
Description | Iterator methods. The over() method must be called first to use these methods. |
---|
Description | Returns the element at the given index. If index is negative, the element relative to the end of the array is returned. Use -1 for the last element. |
---|---|
Parameter | index: The positional index of the element to return. |
Returns | The new array. |
Description | Appends the given array to the list of objects. |
---|---|
Parameter | elements: The array to be added to the original. |
Returns | The new array. |
Description | Builds a list of results matching the filter condition. The callback function must return true if the array element is to be added to the return list or false if not. |
---|---|
Parameter | callback: The callback class to be invoked for each array element. |
Returns | List of filtered results. |
Description | Calls the callback for each element in the array being iterated over. The currentValue argument to the callback function will be null. The return value from the callback function is ignored. |
---|---|
Parameter | callback: The callback class to be invoked for each array element. |
Description | Calls the callback for each element in the array being iterated over. The currentValue argument of the callback function will be first element of the array when first called for the iteration. In subsequent calls, the currentValue will be the last value returned by the callback's function() method. |
---|---|
Parameter | callback: @param callback The callback class to be invoked for each array element. |
Returns | The return value from the last element of the array iterated over. |
Description | Builds an object based on the processing of each element of the array. The currentValue argument of the callback function will be the value of the initialValue argument for the iteration. In subsequent calls, the currentValue will be the last value returned by the callback's function() method. |
---|---|
Parameter | callback: The callback class to be invoked for each array element. |
Parameter | initialValue: The starting value for the iteration. |
Returns | The return value from the last element of the array iterated over. |
Description | Sets the data to be shared between callbacks. |
---|---|
Parameter | shared: The data to be shared between callbacks. |
Returns | The Methods implementation, allowing the call to be chained with over(). |
Description | Builds a list of objects with a transformation applied. This is the equivalent of the Javascript map() function. The callback function must apply the transformation and return the transformed object. |
---|---|
Parameter | callback: The callback class to be invoked for each array element. |
Returns | The list of transformed objects. |