(
state: { type: 'operator'; op: Operator; count: number },
input: string,
ctx: TransitionContext,
)
| 281 | } |
| 282 | |
| 283 | function fromOperator( |
| 284 | state: { type: 'operator'; op: Operator; count: number }, |
| 285 | input: string, |
| 286 | ctx: TransitionContext, |
| 287 | ): TransitionResult { |
| 288 | // dd, cc, yy = line operation |
| 289 | if (input === state.op[0]) { |
| 290 | return { execute: () => executeLineOp(state.op, state.count, ctx) } |
| 291 | } |
| 292 | |
| 293 | if (/[0-9]/.test(input)) { |
| 294 | return { |
| 295 | next: { |
| 296 | type: 'operatorCount', |
| 297 | op: state.op, |
| 298 | count: state.count, |
| 299 | digits: input, |
| 300 | }, |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | const result = handleOperatorInput(state.op, state.count, input, ctx) |
| 305 | if (result) return result |
| 306 | |
| 307 | return { next: { type: 'idle' } } |
| 308 | } |
| 309 | |
| 310 | function fromOperatorCount( |
| 311 | state: { |
no test coverage detected