title: Get a value from a promise function in nodejs
body: <p>I have the following in a <code>utilityfunction.js</code> file:</p>
  
  <pre><code>module.exports = {
   grabValue: function() {
    var params = {
      apiVersion: 'v1',
      endpoint: "https://localhost:8200",
      token: "MY_TOKEN"
    };
  
    var vault = require("node-vault")(params);
    vault.read('secret/mysecret/foo').then(v =&gt; {
       var myvalue = result.data.value;
       resolve(myvalue);
    }).catch(e =&gt; console.error(e));
   }
  };
  </code></pre>
  
  <p>Then in another file called <code>use.js</code> , I import <code>utilityfunction.js</code> like so:</p>
  
  <pre><code>var rUtil = require('./utilityfunction.js'); 
  var getMyValue = rUtil.grabValue();
  </code></pre>
  
  <p>This return an <code>undefined</code> value for <code>getMyValue</code>.</p>
  
  <p>I basically want to return the value from my <code>grabValue</code> function.</p>