Array helpers

The following methods have been made available for you to use in manipulating Array’s.

shuffle

expects Array
Returns: The same array in a different order

index

expects Array, Index(Integer)
Returns: An ArrayItem at the index provided

index_of

expects Array, ArrayItem(Object)
Returns: Returns the index as an Integer of a specified ArrayItem

selected_by

expects Array, Key(String), Value(String/Integer)
Returns: An Array containing all the ArrayItems that match the value of the specified Key

sample

expects Array
Returns: A random ArrayItem from the original Array

delete_by

expects Array, Key(String), Value(String/Integer)
Returns: An Array containing all the ArrayItems that did not match the value of the specified Key

sort_by

expects Array, Key(String), Direction(String)
Returns: The Array passed, sorted by the Key with the desired Direction specified

grouped_by

expects Array, Key(String)
Returns: The Array passed but with the items grouped by the Key specified

join_array

expects Array1, Array2
Returns: The result of both Arrays specified after being combined

value_in_array_contains

expects Array, Value(String/Integer)
Returns: A Boolean if the Array passed contains the Value specified