©2010
<<<<<<< HEAD Generated by JsDoc Toolkit 2.4.0 on Mon Mar 21 2011 06:33:39 GMT-0000 (UTC)
======= Generated by JsDoc Toolkit 2.4.0 on Mon Apr 04 2011 02:43:31 GMT-0000 (UTC)
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff HTML template: Codeview

Built-In Namespace Array

Method Summary
Method Attributes Method Name and Description
  <<<<<<< HEAD
Empties the array of it's contents.
=======
Empties the array of its contents.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
 
copy()
Creates and returns a copy of the array.
 
each(iterator, context)
Call the given iterator once for each element in the array, <<<<<<< HEAD passing in the element as the first argument, the index of ======= passing in the element as the first argument, the index of >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff the element as the second argument, and this array as the third argument.
 
eachSlice(n, iterator, context)
  <<<<<<< HEAD =======
Returns an object containing the extremes of this array.
  >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Returns the first element of the array, undefined if the array is empty.
 
include(element)
Returns true if the element is present in the array.
 
inject(initial, iterator)
 
invoke(method)
Invoke the named method on each element in the array and return a new array containing the results of the invocation.
  <<<<<<< HEAD =======
join(separator)
Joins all elements of an array into a string.
  >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
last()
Returns the last element of the array, undefined if the array is empty.
 
partition(iterator, context)
Partitions the elements into two groups: those for which the iterator returns true, and those for which it returns false.
 
rand()
Randomly select an element from the array.
 
reject(iterator, context)
<<<<<<< HEAD
Return the group of elements for which the iterator's return value is false.
=======
Return the group of elements for which the return value of the iterator is false.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
 
remove(object)
Remove the first occurance of the given object from the array if it is present.
 
select(iterator, context)
<<<<<<< HEAD
Return the group of elements for which the iterator's return value is true.
=======
Return the group of elements for which the return value of the iterator is true.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
 
Returns a new array with the elements all shuffled up.
 
sum()
 
without(values)
Return the group of elements that are not in the passed in set.
 
wrap(start, length)
<<<<<<< HEAD
=======
Pretend the array is a circle and grab a new array containing length elements.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Method Detail
{Array} clear()
<<<<<<< HEAD Empties the array of it's contents. It is modified in place.
Defined in: GameLib.js. ======= Empties the array of its contents. It is modified in place.
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Returns:
this, now emptied.
{Array} copy()
Creates and returns a copy of the array. The copy contains the same objects.
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Returns:
A new array that is a copy of the array
each(iterator, context)
Call the given iterator once for each element in the array, <<<<<<< HEAD passing in the element as the first argument, the index of ======= passing in the element as the first argument, the index of >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff the element as the second argument, and this array as the third argument.
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
{Function} iterator
<<<<<<< HEAD
Function to be called once for =======
Function to be called once for >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff each element in the array.
{Object} context Optional
<<<<<<< HEAD
Optional context parameter to be =======
Optional context parameter to be >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff used as `this` when calling the iterator function.
Returns:
`this` to enable method chaining.
eachSlice(n, iterator, context)

<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
n
iterator
context
<<<<<<< HEAD =======
{Object} extremes(fn)
Returns an object containing the extremes of this array.
[-1, 3, 0].extremes() # => {min: -1, max: 3}

Defined in: gamelib.js.
Parameters:
{Function} fn Optional
An optional funtion used to evaluate each element to calculate its value for determining extremes.
Returns:
{min: minElement|max: maxElement}
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
{Object} first()
Returns the first element of the array, undefined if the array is empty.
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Returns:
The first element, or undefined if the array is empty.
{Boolean} include(element)
Returns true if the element is present in the array.
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
{Object} element
The element to check if present.
Returns:
true if the element is in the array, false otherwise.
inject(initial, iterator)

<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
initial
iterator
{Array} invoke(method)
Invoke the named method on each element in the array and return a new array containing the results of the invocation.
  [1.1, 2.2, 3.3, 4.4].invoke("floor")
  => [1, 2, 3, 4]

  ['hello', 'world', 'cool!'].invoke('substring', 0, 3)
  => ['hel', 'wor', 'coo']

<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
{String} method
The name of the method to invoke.
arg... Optional
Optional arguments to pass to the method being invoked.
Returns:
<<<<<<< HEAD
A new array containing the results of invoking the =======
A new array containing the results of invoking the >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff named method on each element.
<<<<<<< HEAD =======
join(separator)
Joins all elements of an array into a string.
Defined in: gamelib.js.
Parameters:
separator Optional
Specifies a string to separate each element of the array. The separator is converted to a string if necessary. If omitted, the array elements are separated with a comma.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
{Object} last()
Returns the last element of the array, undefined if the array is empty.
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Returns:
The last element, or undefined if the array is empty.
{Array} partition(iterator, context)
Partitions the elements into two groups: those for which the iterator returns true, and those for which it returns false.
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
{Function} iterator
{Object} context Optional
Optional context parameter to be used as `this` when calling the iterator function.
Returns:
An array in the form of [trueCollection, falseCollection]
rand()
Randomly select an element from the array.
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Returns:
A random element from an array
{Array} reject(iterator, context)
<<<<<<< HEAD Return the group of elements for which the iterator's return value is false.
Defined in: GameLib.js. ======= Return the group of elements for which the return value of the iterator is false.
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
{Function} iterator
<<<<<<< HEAD
The iterator receives each element in turn as =======
The iterator receives each element in turn as >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff the first agument.
{Object} context Optional
Optional context parameter to be used as `this` when calling the iterator function.
Returns:
An array containing the elements for which the iterator returned false.
remove(object)
Remove the first occurance of the given object from the array if it is present.
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
{Object} object
The object to remove from the array if present.
Returns:
The removed object if present otherwise undefined.
{Array} select(iterator, context)
<<<<<<< HEAD Return the group of elements for which the iterator's return value is true.
Defined in: GameLib.js. ======= Return the group of elements for which the return value of the iterator is true.
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
{Function} iterator
<<<<<<< HEAD
The iterator receives each element in turn as =======
The iterator receives each element in turn as >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff the first agument.
{Object} context Optional
Optional context parameter to be used as `this` when calling the iterator function.
Returns:
An array containing the elements for which the iterator returned true.
{Array} shuffle()
Returns a new array with the elements all shuffled up.
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Returns:
A new array that is randomly shuffled.
sum()

<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
{Array} without(values)
Return the group of elements that are not in the passed in set.
<<<<<<< HEAD Defined in: GameLib.js. ======= Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
{Array} values
List of elements to exclude.
Returns:
An array containing the elements that are not passed in.
<<<<<<< HEAD ======= {Object or Array} >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff wrap(start, length)
<<<<<<< HEAD
Defined in: GameLib.js. ======= Pretend the array is a circle and grab a new array containing length elements. If length is not given return the element at start, again assuming the array is a circle.
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
<<<<<<< HEAD start
length
======= {Number} start
The index to start wrapping at, or the index of the sole element to return if no length is given.
{Number} length Optional
Optional length determines how long result array should be.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
<<<<<<< HEAD =======
Returns:
The element at start mod array.length, or an array of length elements, starting from start and wrapping.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff