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

Function defaultIntProcessor

packages/effect/src/unstable/cli/Prompt.ts:2856–2871  ·  view source on GitHub ↗
(input: string, state: NumberState)

Source from the content-addressed store, hash-verified

2854 }))
2855
2856const defaultIntProcessor = (input: string, state: NumberState) => {
2857 if (state.value.length === 0 && input === "-") {
2858 return Effect.succeed(Action.NextFrame({
2859 state: { ...state, value: "-", error: Option.none() }
2860 }))
2861 }
2862
2863 const parsed = Number.parseInt(state.value + input)
2864 if (Number.isNaN(parsed)) {
2865 return Effect.succeed(Action.Beep())
2866 } else {
2867 return Effect.succeed(Action.NextFrame({
2868 state: { ...state, value: `${parsed}`, error: Option.none() }
2869 }))
2870 }
2871}
2872
2873const defaultFloatProcessor = (input: string, state: NumberState) => {
2874 if (input === "." && state.value.includes(".")) {

Callers 1

handleProcessIntegerFunction · 0.85

Calls 1

succeedMethod · 0.45

Tested by

no test coverage detected