diff --git a/src/utils/templatehelpers.js b/src/utils/templatehelpers.js index 3681febc2..60944a26a 100644 --- a/src/utils/templatehelpers.js +++ b/src/utils/templatehelpers.js @@ -2,7 +2,13 @@ const templateHelpers = { if: (condition, thenTemplate, elseTemplate = '') => (condition ? thenTemplate : elseTemplate), each: (obj, templateFn) => { const props = Object.keys(obj); - const items = props.map(prop => ({ + const propsIncluded = []; + props.forEach(element => { + if (typeof obj[element] !== 'undefined' && obj[element] !== null && obj[element] !== '') { + propsIncluded.push(element); + } + }); + const items = propsIncluded.map(prop => ({ prop, value: obj[prop] }));