Skip to content

Instantly share code, notes, and snippets.

View govindthakur25's full-sized avatar
💭
Learn, Share, Repeat

GoWin govindthakur25

💭
Learn, Share, Repeat
  • Pune, India
View GitHub Profile
@lamberta
lamberta / parseFunction.js
Created September 23, 2012 03:57
Parse a JavaScript string function definition and return a function object. Does not use eval.
/* Parse a string function definition and return a function object. Does not use eval.
* @param {string} str
* @return {function}
*
* Example:
* var f = function (x, y) { return x * y; };
* var g = parseFunction(f.toString());
* g(33, 3); //=> 99
*/
function parseFunction (str) {