nthOr
function nthOr<T>(
list,
index,
defaultValue): T;
Inspired by lodash nth this will select the given index from an array.
As with the lodash version of nth it will select from the end of the array given a negative index.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
list | T[] |
index | number |
defaultValue | T |
Returns
T
T - if list[index] === undefined, it returns defaultValue