code: function createStateFor(context, stateName, owner) {
    let defaultState = {};
    const StateFactory = owner.factoryFor(`state:${stateName}`);
  
    if (!StateFactory) {
      return EmberObject.create();
    }
  
    const StateFactoryClass = StateFactory.class;
  
    if (typeof StateFactoryClass.initialState === 'function') {
      defaultState = StateFactoryClass.initialState.call(StateFactoryClass, context);
    }
    else if (StateFactoryClass.initialState) {
      throw new TypeError('initialState property must be a function');
    }
  
    if (EmberObject.detect(StateFactoryClass)) {
      return StateFactoryClass.create(
        owner.ownerInjection(),
        defaultState
      );
    }
  
    return EmberObject.create(owner.ownerInjection(), StateFactoryClass);
  }
docs: /*
  Looks up the state factory on the owner and sets initial state
  on the instance if desired.