code: function isComplete(stateOrRegion, instance) {
      if (stateOrRegion instanceof Region) {
          var currentState = instance.getLastKnownState(stateOrRegion);
          return currentState !== undefined && currentState.isFinal();
      }
      else {
          return stateOrRegion.regions.every(function (region) { return isComplete(region, instance); });
      }
  }
docs: Tests a [[State]] or [[Region]] within a state machine instance to see if its lifecycle is complete.
  
  A [[State]] is deemed complete when it has reached a [[FinalState]] or a [[State]] that has no outgoing [[Transition]]s; a [[Region]] is deemed complete if all its child [[Region]]s are complete.
  @param stateOrRegion The [[State]] or [[Region]] to test.
  @param instance The state machine instance.