Class Index | File Index

Classes


Namespace buckets.arrays

buckets.arrays
Defined in: <../buckets.js>.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Contains various functions for manipulating arrays.
Method Summary
Method Attributes Method Name and Description
<static>  
buckets.arrays.contains(array, item, equalsFunction)
Returns true if the array contains the specified element.
<static>  
buckets.arrays.copy(array)
Returns a shallow copy of the specified array.
<static>  
buckets.arrays.equals(array1, array2, equalsFunction)
Returns true if the arrays are equal to one another.
<static>  
buckets.arrays.forEach(array, callback)
Executes a provided function once per array element.
<static>  
buckets.arrays.frequency(array, item, equalsFunction)
Returns the number of elements in the array equal to the specified item.
<static>  
buckets.arrays.indexOf(array, item, equalsFunction)
Returns the index of the first occurrence of the specified item within the specified array.
<static>  
buckets.arrays.lastIndexOf(array, item, equalsFunction)
Returns the index of the last occurrence of the specified element within the specified array.
<static>  
buckets.arrays.remove(array, item, equalsFunction)
Removes the first ocurrence of the specified element from the specified array.
<static>  
buckets.arrays.swap(array, i, j)
Swaps the elements at the specified positions in the specified array.
Namespace Detail
buckets.arrays
Contains various functions for manipulating arrays.
Method Detail
<static> {boolean} buckets.arrays.contains(array, item, equalsFunction)
Returns true if the array contains the specified element.
Parameters:
{*} array
The array in which to search the element.
{Object} item
The element to search.
{function(Object|Object):boolean=} equalsFunction
Optional function to check equality between two elements. Receives two arguments and returns true if they are equal.
Returns:
{boolean} True if the specified array contains the specified element.

<static> {Array} buckets.arrays.copy(array)
Returns a shallow copy of the specified array.
Parameters:
{*} array
The array to copy.
Returns:
{Array} A copy of the specified array.

<static> {boolean} buckets.arrays.equals(array1, array2, equalsFunction)
Returns true if the arrays are equal to one another. Two arrays are considered equal if both arrays contain the same number of elements, all corresponding pairs of elements in the two arrays are equal and are in the same order.
Parameters:
{Array} array1
{Array} array2
{function(Object|Object):boolean=} equalsFunction
Optional function to check equality between two elements. Receives two arguments and returns true if they are equal.
Returns:
{boolean} True if the two arrays are equal.

<static> buckets.arrays.forEach(array, callback)
Executes a provided function once per array element.
Parameters:
{Array} array
The array in which to iterate.
{function(Object):*} callback
function to execute, it is invoked with one argument: the element value. To break the iteration you can optionally return false inside the callback.

<static> {number} buckets.arrays.frequency(array, item, equalsFunction)
Returns the number of elements in the array equal to the specified item.
Parameters:
{Array} array
The array in which to determine the frequency of the element.
{Object} item
The element whose frequency is to be determined.
{function(Object|Object):boolean=} equalsFunction
Optional function to check equality between two elements. Receives two arguments and returns true if they are equal.
Returns:
{number} The number of elements in the specified array. equal to the specified object.

<static> {number} buckets.arrays.indexOf(array, item, equalsFunction)
Returns the index of the first occurrence of the specified item within the specified array.
Parameters:
{*} array
The array to search.
{*} item
The array in which to search the element.
{function(Object|Object):boolean=} equalsFunction
Optional function to check equality between two elements. Receives two arguments and returns true if they are equal.
Returns:
{number} The index of the first occurrence of the specified element or -1 if not found.

<static> {number} buckets.arrays.lastIndexOf(array, item, equalsFunction)
Returns the index of the last occurrence of the specified element within the specified array.
Parameters:
{*} array
The array in which to search the element.
{Object} item
The element to search.
{function(Object|Object):boolean=} equalsFunction
Optional function to check equality between two elements. Receives two arguments and returns true if they are equal.
Returns:
{number} The position of the last occurrence of the specified element within the specified array or -1 if not found.

<static> {boolean} buckets.arrays.remove(array, item, equalsFunction)
Removes the first ocurrence of the specified element from the specified array.
Parameters:
{*} array
The array in which to remove the element.
{*} item
The element to remove.
{function(Object|Object):boolean=} equalsFunction
Optional function to check equality between two elements. Receives two arguments and returns true if they are equal.
Returns:
{boolean} True If the array changed after this call.

<static> {boolean} buckets.arrays.swap(array, i, j)
Swaps the elements at the specified positions in the specified array.
Parameters:
{Array} array
The array in which to swap elements.
{number} i
The index of one element to be swapped.
{number} j
The index of the other element to be swapped.
Returns:
{boolean} True if the array is defined and the indexes are valid.

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Mar 12 2015 00:38:48 GMT-0500 (COT)