title: How to combine functions from many javascript classes into one object
body: <p>I’ve got a quick javascript question. </p>
  
  <p>Say I’ve got <code>RootFile.js</code></p>
  
  <pre><code>import UserApi from './UserApi'
  export default class RootFile {
  
    get userApi() {
      return UserApi;
    }
  };
  </code></pre>
  
  <p>and then I got <code>UserApi.js</code></p>
  
  <pre><code>import Auth from './auth';
  import Profile from './profile';
  
  const merged = {
    ...new Auth, 
    ...new Profile 
  }
  
  export default merged;
  </code></pre>
  
  <p>and then I got separate functionality files like<code>auth.js</code> or <code>profile.js</code>.</p>
  
  <p><code>auth.js</code></p>
  
  <pre><code>export default class Auth{
    authLog(){
      console.log("DONE");
      //Gotta find a way to run this.
    }
  }
  </code></pre>
  
  <p><code>profile.js</code></p>
  
  <pre><code>export default class Profile{
    profileLog(){
      console.log("DONE");
      //Gotta find a way to run this.
    }
  }
  </code></pre>
  
  <p>Now I want to be able to call:</p>
  
  <pre><code>import RootFile from './RootFile'
  
  RootFile.userApi.profileLog();
  //and
  RootFile.userApi.authLog();
  </code></pre>
  
  <p>I can't get that to work, <code>RootFile.userApi</code> is a typeof <code>object</code>, but <code>authLog</code> is <code>undefined</code>.
  What am I doing wrong?</p>