(options: Prompt.Prompt.FloatOptions)
| 373 | |
| 374 | /** @internal */ |
| 375 | export 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 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…