ruby-ejs
ruby-ejs copied to clipboard
Coerce null/undefined to empty string when escaping
When you use escape tags with a null value it will be turned into the string "null", which can be incredibly inconvenient.
For example
value: "<%- null %>"
becomes
value: "null"
This patch changes the result to:
value: ""
This is consistent with the behavior of e.g. erb
:+1: this effects my project as well, and would be a very convenient change
Why not extract the escaping function and put it with the print
one? It would be better to have one function instead of a lot of the same ones.
I was planning on making a follow-up pull request to perform that optimization, and also apply it to the "escape_function" at the same time.
Unfortunately it looks like this project is dead.