Skip to content

Commit

Permalink
use (0,eval)
Browse files Browse the repository at this point in the history
  • Loading branch information
darius committed May 21, 2016
1 parent 1deadd2 commit 86017dd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bytebeat.js
Expand Up @@ -7,10 +7,12 @@ function showAudioVisual(sound, player, viz) {


function compileComposer(text) {
return eval("(function(t) { return "
+ text.replace(/sin|cos|tan|floor|ceil/g,
function(str) { return "Math."+str; })
+ "})");
// (0,eval) explained at
// http://perfectionkills.com/global-eval-what-are-the-options/
return (0,eval)("(function(t) { return "
+ text.replace(/sin|cos|tan|floor|ceil/g,
function(str) { return "Math."+str; })
+ "})");
}


Expand Down

0 comments on commit 86017dd

Please sign in to comment.