title: ES6 export default with multiple functions referring to each other
body: <p>in es6 there you can define a module of functions like this</p>
  
  <pre><code>export default {
      foo() { console.log('foo') }, 
      bar() { console.log('bar') },
      baz() { foo(); bar() }
  }
  </code></pre>
  
  <p>the above seems to be valid code, but if I call <code>baz()</code> it throws an error: </p>
  
  <p><code>ReferenceError: foo is not defined</code></p>
  
  <p>How do you call <code>foo</code> from another function? in this case <code>baz</code></p>
  
  <p><strong>Edit</strong></p>
  
  <p>Here's the code that actually doesn't work. I have simplified the code so it's only the core as needed</p>
  
  <pre><code>const tokenManager =  {
    revokeToken(headers) { 
      ... 
    },
    expireToken(headers) {
      ...
    },
    verifyToken(req, res, next) {
      jwt.verify(... =&gt; {
        if (err) {
          expireToken(req.headers)
        }
      })
    }
  }
  
  export default tokenManager 
  </code></pre>
  
  <p>and the error is</p>
  
  <pre><code>expireToken(req.headers);
          ^
  ReferenceError: expireToken is not defined
  </code></pre>
  
  <p><strong>Edit 2</strong></p>
  
  <p>I just tried adding <code>tokenManager</code> before <code>expireToken</code> and it finally works</p>