Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Effect-TS/effect
/ clamp
Function
clamp
packages/effect/src/Array.ts:915–915 ·
view source on GitHub ↗
(i: number, as: ReadonlyArray<A>)
Source
from the content-addressed store, hash-verified
913
}
914
915
const
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
Callers
1
Array.ts
File · 0.70
Calls
no outgoing calls
Tested by
no test coverage detected