namespace
SAPO.Utility.Array
Utility functions to use with Arrays
Function Summary
Returns an array containing every item that is shared between the two given arrays
returns the associated key of an array value
Function Details
function convert
Convert lists type to type array
Parameters:
arr
function each
runs a functions through each of the elements of an array
Parameters:
arr
cb
- the function recieves as arguments value, index and array function inArray
Boolean
inArray(Any
value, Array
arr)
checks if value exists in array
Parameters:
value
arr
function insert
Insert value into the array on specified idx
Parameters:
arr
idx
value
function intersect
Returns an array containing every item that is shared between the two given arrays
Parameters:
arr1
arr2
function keyValue
returns the associated key of an array value
Parameters:
value
arr
[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
arr)
returns the array shuffled, false if the param is not an array
Parameters:
arr
function sortMulti
sorts an array of object by an object property
Parameters:
arr
array of objects to sort
value
property to sort by