From e599dd51fc62c119885378d8284cb5540d9acafb Mon Sep 17 00:00:00 2001 From: Rishi Sheth Date: Mon, 2 Dec 2024 16:20:42 -0800 Subject: [PATCH] simplify --- src/javascripts/lib/helpers.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/javascripts/lib/helpers.js b/src/javascripts/lib/helpers.js index edfcb8c..50822b0 100644 --- a/src/javascripts/lib/helpers.js +++ b/src/javascripts/lib/helpers.js @@ -21,9 +21,7 @@ export function resizeContainer (max = Number.POSITIVE_INFINITY) { * @return {String} final template */ export function templatingLoop (set, getTemplate, initialValue = '') { - return set.reduce((accumulator, item, index) => { - return `${accumulator}${getTemplate(item, index)}` - }, initialValue) + return set.reduce((accumulator, item, index) => `${accumulator}${getTemplate(item, index)}`, initialValue) } /** @@ -48,15 +46,7 @@ export function render (replacedNodeSelector, htmlString) { export function escapeSpecialChars (str) { if (typeof str !== 'string') throw new TypeError('escapeSpecialChars function expects input in type String') - const escape = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`', - '=': '=' - } + const escape = {'&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '`': '`', '=': '='} return str.replace(/[&<>"'`=]/g, function (m) { return escape[m] }) }