import type { array, matrix } from "../types"; /** * Returns the last index in an array or matrix. * * Returns the last index of an array or matrix. For matrices, you can specify the dimension: -1 for both rows and columns, 0 for rows, and 1 for columns. * * @param x Input array or matrix. * @param dim For matrix: -1 (both), 0 (rows), 1 (columns). Defaults to -1. * @returns Last index or indices. * @throws If no arguments are provided or if the dimension is invalid. * * @example Last index of a vector * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(end([5, 6, 3]), 2); * * ``` * * @example Last indices of a matrix * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(end([[4, 5, 0], [-1, 2, -3]]), [1, 2]); * * ``` * * @example Last row index of a matrix * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(end([[4, 5, 0], [-1, 2, -3]], 0), 1); * * ``` * * @example Last column index of a matrix * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(end([[4, 5, 0], [-1, 2, -3]], 1), 2); * * ``` * * @example Last index of a number (returns the number itself) * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(end(5), 5); * * ``` */ export default function end(x: number | array | matrix, dim?: number): number | array; //# sourceMappingURL=end.d.ts.map