MCPcopy Create free account
hub / github.com/effect-app/libs / isOutOfBounds

Function isOutOfBounds

repos/effect/packages/effect/src/Array.ts:916–918  ·  view source on GitHub ↗
(i: number, as: ReadonlyArray<A>)

Source from the content-addressed store, hash-verified

914
915const clamp = <A>(i: number, as: ReadonlyArray<A>): number => Math.floor(Math.min(Math.max(0, i), as.length))
916
917/**
918 * Reads an element at the given index safely, returning `Option.some` or
919 * `Option.none` if the index is out of bounds.
920 *
921 * **When to use**

Callers 1

Array.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…