State Machines work for logic too
The idea of processing boolean flags can get complicated. Maybe a Finite State Machine could help. See how I use an ad-hoc FSM to parse low-fi URI Template syntax.
Tags: javascript, state, statechart, statemachine