code: function normalizeModules(modules) {
      var normalized = {};
  
      Object.keys(modules).forEach(function (key) {
          var module = modules[key];
  
          // make sure each vuex module has all keys defined
          normalized[key] = {
              actions: module.actions || {},
              getters: module.getters || {},
              modules: module.modules ? normalizeModules(module.modules) : {},
              mutations: module.mutations || {},
              namespaced: module.namespaced || false,
              state: {}
          };
  
          // make sure our state is a fresh object
          if (typeof module.state === 'function') {
              normalized[key].state = module.state();
          } else if (_typeof(module.state) === 'object') {
              normalized[key].state = JSON.parse(JSON.stringify(module.state));
          }
      });
  
      return normalized;
  }
docs: helper function to evaluate the state functions of vuex modules