( state: State, input: string )
| 170 | } |
| 171 | |
| 172 | function defaultFloatProcessor( |
| 173 | state: State, |
| 174 | input: string |
| 175 | ) { |
| 176 | if (input === "." && state.value.includes(".")) { |
| 177 | return Effect.succeed(Action.Beep()) |
| 178 | } |
| 179 | if (state.value.length === 0 && input === "-") { |
| 180 | return Effect.succeed(Action.NextFrame({ |
| 181 | state: { ...state, value: "-", error: Option.none() } |
| 182 | })) |
| 183 | } |
| 184 | return Effect.match(parseFloat(state.value + input), { |
| 185 | onFailure: () => Action.Beep(), |
| 186 | onSuccess: (value) => |
| 187 | Action.NextFrame({ |
| 188 | state: { |
| 189 | ...state, |
| 190 | value: input === "." ? `${value}.` : `${value}`, |
| 191 | error: Option.none() |
| 192 | } |
| 193 | }) |
| 194 | }) |
| 195 | } |
| 196 | |
| 197 | const initialState: State = { |
| 198 | cursor: 0, |
no outgoing calls
no test coverage detected
searching dependent graphs…