MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / clamp

Function clamp

apps/kimi-web/src/composables/useResizable.ts:59–62  ·  view source on GitHub ↗
(value: number)

Source from the content-addressed store, hash-verified

57 const { storageKey, defaultWidth, min, max, reverse = false } = options;
58
59 function clamp(value: number): number {
60 if (!Number.isFinite(value)) return defaultWidth;
61 return Math.min(toValue(max), Math.max(min, Math.round(value)));
62 }
63
64 const width = ref<number>(clamp(readStored(storageKey) ?? defaultWidth));
65 const dragging = ref(false);

Callers 3

useResizableFunction · 0.70
setWidthFunction · 0.70
onPointerDownFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected