On the EJS github page, there is one and only one simple example: https://github.com/visionmedia/ejs
Example
<% if (user) { %>
&
if you plan to use the same object often, you could use a function like this:
<% function userObj(obj){
//replace user with what you name your object
if(typeof user === 'object'){
let result = user;
if(obj){
obj = obj.split('.');
for(let i = 0; i < obj.length; i++){
if(obj[i] && obj[i].trim() !== '' && result[obj[i]]){
result = result[obj[i]];
}else{
result = false;
break;
}
}
}
return result;
}
return false;
} %>
usage:
<% if(userObj('name')){
<%= userObj('name') %>
} %>