MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / clamp01

Function clamp01

packages/core/src/query/contact-scoring.ts:58–63  ·  view source on GitHub ↗
(value: number)

Source from the content-addressed store, hash-verified

56}
57
58function clamp01(value: number): number {
59 if (!Number.isFinite(value)) return 0
60 if (value < 0) return 0
61 if (value > 1) return 1
62 return value
63}
64
65function nonNegative(value: number | null | undefined): number {
66 return Number.isFinite(value) && value !== null && value !== undefined ? Math.max(0, value) : 0

Callers 2

computeFriendScoreFunction · 0.85
computeNonFriendScoreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected