UNPKG

@quinck/collections

Version:

Allows extra operations on JavaScript collections: Array, Map and Set.

28 lines (27 loc) 913 B
export {}; declare global { interface Array<T> { /** * Retrieve the first element of the array. * @throws {ArrayIndexOutOfBoundsError} * @returns the first element of the array */ first: T; /** * Retrieve the first element of the array or undefined if the array is empty. * @returns the first element of the array or undefined if the array is empty */ firstOrDefault: T | undefined; /** * Retrieve the last element of the array. * @throws {ArrayIndexOutOfBoundsError} * @returns the last element of the array */ last: T; /** * Retrieve the last element of the array or undefined if the array is empty. * @returns the last element of the array or undefined if the array is empty */ lastOrDefault: T | undefined; } }