Namespace: array

qui.utils.array

Methods

(static) distinct(array, equalsFuncopt, thisArgopt) → {Array}

Return an array of distinct elements found in an input array.

Parameters:
Name Type Attributes Description
array Array
equalsFunc function <optional>

a comparison function (defaults to the === operator)

thisArg * <optional>

optional argument to be used as this when calling equalsFunc

Source:
Returns:

the distinct elements array

Type
Array

(static) range(start, stop, stepopt) → {Array.<Number>}

Generate an array based on a range of numbers.

Parameters:
Name Type Attributes Description
start Number

inclusive range start

stop Number

exclusive range stop

step Number <optional>

range step (defaults to 1)

Source:
Returns:
Type
Array.<Number>

(static) remove(array, element)

Remove all occurrences of an element from an array, in place.

Parameters:
Name Type Description
array Array
element *

the element to remove

Source:

(static) removeMany(array, elements)

Remove all occurrences of a set of elements from an array, in place.

Parameters:
Name Type Description
array Array
elements Array

the set of elements to remove

Source:

(static) sortKey(array, func, descopt, thisArgopt) → {Array}

Perform a sort on an array, in place, using a key extraction function.

Parameters:
Name Type Attributes Description
array Array
func function

key extraction function; will be called with each element as parameter and is expected to return the comparison key

desc Boolean <optional>

whether to do a descending sort (defaults to false)

thisArg * <optional>

optional argument to use as this when calling the key extraction function.

Source:
Returns:

the array

Type
Array

(static) stableSort(array, compareFunc) → {Array}

Perform a stable sort on an array, in place, using a comparison function.

Parameters:
Name Type Description
array Array
compareFunc function

comparison function; takes two elements as parameters and returns -1, 0or1`

Source:
Returns:

the array

Type
Array

(static) stableSortKey(array, func, descopt, thisArgopt) → {Array}

Perform a stable sort on an array, in place, using a key extraction function.

Parameters:
Name Type Attributes Description
array Array
func function

key extraction function; will be called with each element as parameter and is expected to return the comparison key

desc Boolean <optional>

whether to do a descending sort (defaults to false)

thisArg * <optional>

optional argument to use as this when calling the key extraction function.

Source:
Returns:

the array

Type
Array