MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / clampPosition

Function clampPosition

src/pages/problems/problems.js:154–157  ·  view source on GitHub ↗
(pos, length)

Source from the content-addressed store, hash-verified

152 }
153
154 function clampPosition(pos, length) {
155 if (typeof pos !== "number" || Number.isNaN(pos)) return 0;
156 return Math.max(0, Math.min(pos, Math.max(0, length)));
157 }
158
159 function normalizeIndex(value) {
160 if (typeof value === "number" && Number.isFinite(value)) {

Callers 1

readLspAnnotationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected