MCPcopy Create free account
hub / github.com/Effect-TS/effect / isOutOfBounds

Function isOutOfBounds

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

Source from the content-addressed store, hash-verified

909
910/** @internal */
911export function isOutOfBounds<A>(i: number, as: ReadonlyArray<A>): boolean {
912 return !Number.isFinite(i) || i < 0 || i >= as.length
913}
914
915const clamp = <A>(i: number, as: ReadonlyArray<A>): number => Math.floor(Math.min(Math.max(0, i), as.length))
916

Callers 1

Array.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected