Return null if the provided argument is empty

This commit is contained in:
Alex Tselegidis 2022-10-16 21:55:59 +03:00
parent 0f6df76667
commit bbf63001da

View file

@ -22,7 +22,7 @@ App.Utils.CalendarEventPopover = (function () {
* *
* @param {Object} user Should have the address, city, etc properties. * @param {Object} user Should have the address, city, etc properties.
* *
* @return {string} The rendered HTML. * @return {String} The rendered HTML.
*/ */
function renderMapIcon(user) { function renderMapIcon(user) {
const data = []; const data = [];
@ -44,7 +44,7 @@ App.Utils.CalendarEventPopover = (function () {
} }
if (!data.length) { if (!data.length) {
return ''; return null;
} }
return $('<div/>', { return $('<div/>', {
@ -69,9 +69,13 @@ App.Utils.CalendarEventPopover = (function () {
* *
* @param {String} email * @param {String} email
* *
* @return {string} The rendered HTML. * @return {String} The rendered HTML.
*/ */
function renderMailIcon(email) { function renderMailIcon(email) {
if (!email) {
return null;
}
return $('<div/>', { return $('<div/>', {
'html': [ 'html': [
$('<a/>', { $('<a/>', {
@ -94,9 +98,13 @@ App.Utils.CalendarEventPopover = (function () {
* *
* @param {String} phone * @param {String} phone
* *
* @return {string} The rendered HTML. * @return {String} The rendered HTML.
*/ */
function renderPhoneIcon(phone) { function renderPhoneIcon(phone) {
if (!phone) {
return null;
}
return $('<div/>', { return $('<div/>', {
'html': [ 'html': [
$('<a/>', { $('<a/>', {