Array Extensions
The Pageflake framework modifies the Array object prototype to provide several utility functions.
|
|
Adds the item to the end of the array. |
|
|
Removes the item at the specified position. |
|
|
Searches the array for the passed item and returns the |
|
|
Searches the array for the passed items and, if found, |
|
|
Returns true if the items |
|
|
Evaluates the passed function for every item in the array and returns the first item that when passed as an argument to the function, makes the function return true. If no items make the function evaluate to true, then null is For example: Instead of: var item;
for (var i=0; i < someArray.length; i++ )
{
if( someArray[i].a == 1 )
{
item = someArray[i];
break;
}
} |
|
|
Evaluates the passed function for every item in the array and returns the first item that when passed as an argument to the function, makes the function return true. If no items make the function evaluate to true, then -1 is returned. |
|
|
Evaluates the passed function once for every item in the array passing two parameters each time. The first parameter is the item itself, and the second parameter is the array index where the item was retrieved from. |

