Methods
-
<static> add(arr, value)
-
Add an object to an array if it not already exists
Parameters:
Name Type Description arr
Array The array
value
Object The object to add
-
<static> contains(arr, value)
-
Check if an array contains a value
Parameters:
Name Type Description arr
Array The array
value
Object The object to check for
Returns:
true if the value is in the array
- Type
- boolean
-
<static> flip(arr, value)
-
Add or remove a value from an array.
If the value exists all instances are removed, otherwise the value is addedParameters:
Name Type Description arr
Array The array to change
value
Object The value to flip
-
<static> indexOf(arr, value)
-
Find the first index of a value in an array, -1 if not found
Parameters:
Name Type Description arr
Array The array to inspect
value
Object The value to find
Returns:
The index of the first occurrence, -1 if not found.
- Type
- Number
-
<static> remove(arr, value)
-
Remove all instances of a value from an array
Parameters:
Name Type Description arr
Array The array to change
value
Object The value to remove
-
<static> toIntegers(The)
-
Split a string, like "1,4,6" into an array of integers.
Parameters:
Name Type Description The
String string to split
Returns:
An array of integers
- Type
- Array