UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

23 lines (21 loc) 565 B
import { NonNil } from "../internals/types.js"; //#region src/array/atOrThrow.d.ts /** * `atOrThrow(array, offset)` * * Returns the value at the specified `offset`, throws an exception if the `offset` was out of range, or the retrieved value was nullable. * * ```ts * atOrThrow([1, null], -1); // Error * ``` * * ```ts * pipe([1, null], atOrThrow(-1)); // Error * ``` */ declare const atOrThrow: { (offset: number): <T>(target: readonly T[]) => NonNil<T>; <T>(target: readonly T[], offset: number): NonNil<T>; }; //#endregion export { atOrThrow };