Apparently, this is harder to find than I thought it would be. And it even is so simple...
Is there a function equivalent to PHP\'s htmlspecialchars built into Javas
For Node.JS users (or users utilizing Jade runtime in the browser), you can use Jade's escape function.
require('jade').runtime.escape(...);
No sense in writing it yourself if someone else is maintaining it. :)