We all love JS, don't we? Yes, we do. But, unfortunately, JS does not allow us to insert variables inside a string. We must close our quotes, concatenate with a + operator, and live our lives. What this tiny script does is replace anything inside #{ } for a variable. Ruby users know what this is.
Let's say, you have two variables:
var mood = "nice";
var person = "Bob";
And this is the string you want to format:
var myString = "This is #{mood}, isn't it, #{person}?";
You would simply do a:
myString.pretify();
And this is your result:
"This is nice, isn't it, Bob?"
I find it pretty fast-forward, and useful :)
Eval is evil!
"#{alert('it beats you!')}".pretify()