Grape.Array Class
An array class created with Grape.Class mixing all of the Array.prototype methods and some new utility. Some functions are modified (like slice) to return a new instance of the current class instead of a plain array. If you extend this class, these methods will return an instance of your class. In the future, we should create implementations of default methods for old browsers. Note that adding elements with indexing does not change the length property unlike the native Array.
Constructor
Grape.Array
    
        ()
    
    
    
    
    
    
    
    
    
    Methods
apply
    
        - 
                    
                        which
- 
                    
                        params
Calls a method of each item, but the parameters are passed as an array like in Function.prototype.apply
Parameters:
- 
                    
                        whichStringThe method name to call 
- 
                    
                        paramsArrayThe method parameters 
Returns:
this
attr
    
        - 
                    
                        name
- 
                    
                        newVal
Sets an attribute on each item.
Parameters:
- 
                    
                        nameStringThe attribute name 
- 
                    
                        newValThe new value of the attribute 
Returns:
this
call
    
        - 
                    
                        which
Calls a method of each item. The subsequent parameters are passed to the method.
Parameters:
- 
                    
                        whichStringThe method name to call 
Returns:
this
clone
    
        ()
    
    
        
            
        
    
    
    
    
    
    
    
    
    Clones the array (shallow copy) by creating a new instance of the current class.
Returns:
The cloned array
eq
    
        - 
                    
                        i
Creates a new instance of the current class, containing the item at the index i if exists, or an empty array
Parameters:
- 
                    
                        iNumberThe index 
Returns:
The array containing 0 or 1 item
get
    
        - 
                    
                        i
Returns an item at the given position. Equivalent to arr[i].
Parameters:
- 
                    
                        iNumberThe index of the item to return 
Returns:
The item at the given position
isEmpty
    
        ()
    
    
        
            Boolean
        
    
    
    
    
    
    
    
    
    Returns true if the length of the array is 0.
Returns:
true, if length is 0
one
    
        ()
    
    
        
            
        
    
    
    
    
    
    
    
    
    Returns one (the first) item from the array.
Returns:
The first item
random
    
        - 
                    
                        num
Returns a new instance of the current class containing random items from the original array.
Parameters:
- 
                    
                        numNumber | UndefinedThe number of random items. If not set returns one item. 
Returns:
The random items
size
    
        ()
    
    
        
            Number
        
    
    
    
    
    
    
    
    
    Returns the length of the array.
Returns:
The size of the array
toArray
    
        ()
    
    
        
            Array
        
    
    
    
    
    
    
    
    
    Creates a native Array by copying the items
Returns:
The native Array
