What I need to do, is add a colon to the end of all object literals in the function string if there isn't one. The Apps Script API is giving me an error that there is an "unexpected token" if I don't add a colon to the end of an object literal, when there is no \n newline character after the curly brace.
I can't add a semicolon to every ending curly brace without a semicolon, because that will also generate an error in some situations.
I wonder if there is a way to evaluate the function string somehow and have JavaScript somehow process it to the valid format?