Core Docs | Additional Modules Docs

Array.prototype.current


@Description: Returns the array value of the key we are currently on as referenced by the pointer. Starts at 0 and chanegs base don use of next(), prev(), rewind(), end()
@File: Array/prototype/iteration.js
@Example:
var myArray = [1,10,2,3,4,5];
myArray.current(); //returns 1 at first

//after manipulations it changes reference based on the pointer
myArray.next();

//now it is the next one
myArray.current(); //returns 10

Array.prototype.end


@Description: Returns the array value of the last key and sets the array's pointer to that key
@File: Array/prototype/iteration.js
@Example:
var myArray = [1,10,2,3,4,5];
myArray.end(); //sets the pointer to the last array key and returns the value, in this case 5

Array.prototype.first


@Description: Returns the first value in the array without moving the pointer.
@File: Array/prototype/iteration.js
@Example:
var myArray = [1,10,2,3,4,5];
myArray.first(); //returns 1

Array.prototype.iteration


@Description: Can be used to iterate arrays with next, rewind, forward,
@File: Array/prototype/iteration.js

Array.prototype.last


@Description: Returns the last value of the array without moving the pointer.
@File: Array/prototype/iteration.js
@Example:
var myArray = [1,10,2,3,4,5];
myArray.last(); //returns 5

Array.prototype.next


@Description: Returns the next value of the array and moves the pointer forward to it.
@File: Array/prototype/iteration.js
@Example:
var myArray = [1,10,2,3,4,5];
myArray.current(); //returns 1
myArray.next(); //returns 10
myArray.current(); //returns 10

Array.prototype.pointer


@Description: Used to keep track of the array key we are referenceing with next, prev, end, current, rewind
@File: Array/prototype/iteration.js

Array.prototype.prev


@Description: Returns the next value of the array and moves the pointer forward to it.
@File: Array/prototype/iteration.js
@Example:
var myArray = [1,10,2,3,4,5];
myArray.end(); //returns 5
myArray.prev(); //returns 4
myArray.current(); //returns 4

Array.prototype.rewind


@Description: Returns the first value of the array and moves the pointer back to the beginning.
@File: Array/prototype/iteration.js
@Example:
var myArray = [1,10,2,3,4,5];
myArray.rewind(); //returns 1

Array.prototype.cycle


@Description: Cycles through an array by incrememtning its pointer and reseting it back to the beginng (0) when it gets to the end.
@File: Array/prototype/iteration.js
@Author: Paul Visco
@Version: 1.2 08/21/09
@Param: Number direction Accepts either 1 for ascending order or -1 for decending order. If not specified that ascending order is the default.
@Return: Array Returns The array sorted naturally.
@Example:
var myArray = [1,10,2,3,4,5];
var answer = myArray.cycle();
alert(myArray.cycle());