I'm using Node.js and ejs for templating language.
I feel like this is really silly and I should be able to solve it, but I'm stuck.
I am having trouble with the following function:
// Returns true if campground has been posted by currently logged on user
// If no user logged on, returns false
function checkIfCampgroundBelongsToUser(campgroundAuthorID) {
var currentUser = <%-JSON.stringify(currentUser) %>
if(currentUser && currentUser._id === campgroundAuthorID) {
return true;
}
return false;
}
This code works fine when a user is logged in. However, when no user is logged in evaluates to empty. Not empty string. Not null. Not undefined. Just empty. Thus, I get the following error
Uncaught SyntaxError: Unexpected token if
When I inspect via chrome dev tools, this is what I see
(yes I realize a semi-colon is missing, I added it... And when I do, I get uncaught syntaxError: Unexpected token ;)

<%-currentUser ? JSON.stringify(currentUser) : "null" %>