code: function parseArguments(args) {
          var defaultConfig = {
              stateKey: 'instances',
              instanceKey: 'id'
          };
  
          if (typeof args[0] === 'function') {
              return {
                  callback: args[0],
                  config: defaultConfig
              };
          } else {
              return {
                  callback: args[1],
                  config: Object.assign({}, defaultConfig, args[0])
              };
          }
      }
docs: helper to get config and callback from the arguments