title: is there a way to eval() export in js
body: <p>i want to generate code that creates actions and actions creators for redux
  when i tried to do that the app breaks and tells me that i cannot eval export
  is there a way to do this?
  example of the code:</p>
  <pre><code>const actions = ['GET_USERS', 'GET_USERS_SUCCESS'];
  let actions_to_evalute = '';
  
  function createActions(actions) {
      actions.forEach(a =&gt; {
          actions_to_evalute += `const ${a} = '${a}';\n`;
          // create from action action creators
          let arr =  a.toLowerCase().split('_');
          console.log(arr)
          let maxIndex = arr.length-1;
          arr.forEach((val, i)=&gt;{
          console.log(val,i);
              if (i===0) {
                  actions_to_evalute += `export function ${val}`;
              } else if (i&gt;0 &amp;&amp; i &lt; maxIndex ) {
                  actions_to_evalute += `${val.charAt(0).toUpperCase()}${val.substring(1)}`
              } else if (i=== maxIndex) {
                  actions_to_evalute += `${val.charAt(0).toUpperCase()}${val.substring(1)}(){
                      return {
                          type: ${a}
                      }
                  }\n`;
              }
          })
      });
  
      return actions_to_evalute;
  }
  
  eval(createActions(actions));
  </code></pre>