A minimal finite state machine for JavaScript