Replace var lib = eval(code); on the:
var lib = eval('(' + code + ')');
When the pairs are omitted, curly braces are interpreted as markers of the code block. As a result, the return value of eval is a fetchData function, not an object containing a function.
When the function name is missing, the code inside the block is read as the designated anonymous function operator, which is not valid.
After adding partners, curly braces are used as object literals (as expected), and the return value of eval is an object with the fetchData method. Then your code will work.
Rob w source share