Namespace: array

hui. array

Source:

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

Source:

<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

Source:
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 added

Parameters:
Name Type Description
arr Array

The array to change

value Object

The value to flip

Source:

<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

Source:
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

Source:

<static> toIntegers(The)

Split a string, like "1,4,6" into an array of integers.

Parameters:
Name Type Description
The String

string to split

Source:
Returns:

An array of integers

Type
Array