title: Is it possible to use RequireJS on a given javascript string?
body: <p>As far as my understanding of RequireJS goes it's used to include a javascript file given a specific url: <code>define([foo/bar.js], function(...))</code>, but my use case is a little strange. I need it to require an actual javascript string instead, i.e.:</p>
  
  <pre><code>var str = "function def() { var func1 = function() { ... }; var func2 = function() { ... }; return { func1: func1, func2: func2 };}"
  
  define([str], function(...))
  </code></pre>
  
  <p>While doing an eval with an IIFE might work with the above string it doesn't seem to work with my actual use case, which I'm unsure why that is but it does work if I have the string located in a js file that I then use define on so I'm assuming RequireJS is doing something a little more than just an eval. Any assistance would be appreciated!</p>