[Elements] are optional
Class SAPO.Utility.Array
class
SAPO.Utility.Array
Utility functions to use with Arrays
Defined in
Utility/Array/0.1/lib.jsInclusion link: http://js.sapo.pt/SAPO/Utility/Array/0.1/
Sample: http://js.sapo.pt/SAPO/Utility/Array/sample/
Function Summary
returns the associated key of an array value
Function Details
function each
runs a functions trou each of the elements of an array
Parameters:
arr
callBack
- the function recieves as arguments value, index and array function inArray
Boolean
inArray(Any
value, Array
array)
Check if value exists in array
Parameters:
value
array
Returns:
true if the element exists
function keyValue
returns the associated key of an array value
Parameters:
value
array
[param]
to set if want the key of the first found value
Returns:
false if not exists | number if exists and 3rd input param is true | array if exists and 3rd input param is not set or it is !== true
function shuffle
Boolean|Array
shuffle(Array
array)
returns the array shuffled
Parameters:
array
Returns:
false if the param is not an array or array shuffled
function sortMulti
Sort an array of object by an object property
Parameters:
value
property to sort by
array
- array of objects to sort
Returns:
the sorted array or false if not an array