Package: effect
Module: Array
Reads an element at the given index, throwing if the index is out of bounds.
When to use
Use to read an array element at a known valid index when out-of-bounds would be a programming error.
Details
Throws an Error with the message "Index out of bounds: <i>". Prefer
get for safe access.
Example (Accessing indexes unsafely)
import { Array } from "effect"
console.log(Array.getUnsafe([1, 2, 3], 1)) // 2
// Array.getUnsafe([1, 2, 3], 10) // throws Error
See
get — safe version returning OptionSignature
declare const getUnsafe: { (index: number): <A>(self: ReadonlyArray<A>) => A; <A>(self: ReadonlyArray<A>, index: number): A; }
Since v4.0.0