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

Function float

packages/cli/src/internal/prompt/number.ts:375–398  ·  view source on GitHub ↗
(options: Prompt.Prompt.FloatOptions)

Source from the content-addressed store, hash-verified

373
374/** @internal */
375export const float = (options: Prompt.Prompt.FloatOptions): Prompt.Prompt<number> => {
376 const opts: FloatOptions = {
377 min: Number.NEGATIVE_INFINITY,
378 max: Number.POSITIVE_INFINITY,
379 incrementBy: 1,
380 decrementBy: 1,
381 precision: 2,
382 validate: (n) => {
383 if (n < opts.min) {
384 return Effect.fail(`${n} must be greater than or equal to ${opts.min}`)
385 }
386 if (n > opts.max) {
387 return Effect.fail(`${n} must be less than or equal to ${opts.max}`)
388 }
389 return Effect.succeed(n)
390 },
391 ...options
392 }
393 return InternalPrompt.custom(initialState, {
394 render: handleRenderFloat(opts),
395 process: handleProcessFloat(opts),
396 clear: handleClear(opts)
397 })
398}

Callers

nothing calls this directly

Calls 4

handleRenderFloatFunction · 0.85
handleProcessFloatFunction · 0.85
handleClearFunction · 0.70
failMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…