Namespace: array

me.utils. array

a collection of array utility functions
Source:
array.js, line 9

Methods

<static> random(arr) → {any}

return a random array element
Parameters:
Name Type Description
arr Array array to pick a element
Source:
array.js, line 37
Returns:
random member of array
Type
any
Example
// Select a random array element
var arr = [ "foo", "bar", "baz" ];
console.log(me.utils.array.random(arr));

<static> remove(arr, object) → {Array}

Remove the specified object from the given Array
Parameters:
Name Type Description
arr Array array from which to remove an object
object Object to be removed
Source:
array.js, line 18
Returns:
the modified Array
Type
Array

<static> weightedRandom(arr) → {any}

return a weighted random array element, favoring the earlier entries
Parameters:
Name Type Description
arr Array array to pick a element
Source:
array.js, line 54
Returns:
random member of array
Type
any