IF(!!!) you can get the toString()
, then you can simply take the substring from the first indexOf("{")
to the lastIndexOf("}")
. So, something like this “works” (as seen on ideone.com):
var test = function () {alert(1);}
var entire = test.toString(); // this part may fail!
var body = entire.substring(entire.indexOf("{") + 1, entire.lastIndexOf("}"));
print(body); // "alert(1);"