@@ -6,12 +6,16 @@ import {Machine, assign} from "xstate@4/dist/xstate.web.js";
66import { Context , createElement } from "@b9g/crank" ;
77import { renderer } from "@b9g/crank/dom" ;
88
9- const not = ( fn ) => ( ...args ) => ! fn . apply ( null , args ) ;
9+ const not =
10+ ( fn ) =>
11+ ( ...args ) =>
12+ ! fn . apply ( null , args ) ;
1013const isZero = ( context , event ) => event . key === 0 ;
1114const isNotZero = not ( isZero ) ;
1215const isMinus = ( context , event ) => event . operator === "-" ;
1316const isNotMinus = not ( isMinus ) ;
14- const divideByZero = ( context ) => context . operand2 === "0." && context . operator === "/" ;
17+ const divideByZero = ( context ) =>
18+ context . operand2 === "0." && context . operator === "/" ;
1519const notDivideByZero = not ( divideByZero ) ;
1620
1721function doMath ( operand1 , operand2 , operator ) {
@@ -421,7 +425,10 @@ function* Calculator(this: Context) {
421425 if ( Number . isInteger ( + label ) ) {
422426 state = calcMachine . transition ( state , { type : "NUMBER" , key : + label } ) ;
423427 } else if ( isOperator ( label ) ) {
424- state = calcMachine . transition ( state , { type : "OPERATOR" , operator : label } ) ;
428+ state = calcMachine . transition ( state , {
429+ type : "OPERATOR" ,
430+ operator : label ,
431+ } ) ;
425432 } else if ( label === "C" ) {
426433 state = calcMachine . transition ( state , { type : "CLEAR_EVERYTHING" } ) ;
427434 } else if ( label === "." ) {
0 commit comments