- Source:
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 |
thisArg |
* |
<optional> |
optional argument to be used as |
- 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 |
- 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.
As with Array#sort, undefined entries and holes end up at the end of the array, in that order, and the key
extraction function is not called for them. It is called once per remaining element.
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 |
thisArg |
* |
<optional> |
optional argument to use as |
- 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 |
- 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.
As with Array#sort, undefined entries and holes end up at the end of the array, in that order, and the key
extraction function is not called for them. It is called once per remaining element.
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 |
thisArg |
* |
<optional> |
optional argument to use as |
- Source:
Returns:
the array
- Type
- Array