Call _.template() with no argument.
Call _.template() with no argument will trigger error as the following:
Uncaught TypeError: Cannot call method 'replace' of undefined
This error message is not friendly.
The code brought the issue in is at line 1127.
text.replace(...)
Because text is undefined.
Hi @pktangyue! Because of the dynamic nature of javascript, type checking arguments would be prohibitively expensive in code size and readability. Also, I think that the error message is fairly self explanatory if not friendly, especially with a stack trace pointing to _.template and its caller. Thanks for pointing it out, but this is the intended behavior.
fwiw I've allowed falsey arguments to most methods for consistency. For _.template I've just done text || (text = '');
That seems fine to me, and in line with other methods like _.escape/_.unescape.