Skip to content

Commit e599dd5

Browse files
committed
simplify
1 parent 7703b7c commit e599dd5

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/javascripts/lib/helpers.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ export function resizeContainer (max = Number.POSITIVE_INFINITY) {
2121
* @return {String} final template
2222
*/
2323
export function templatingLoop (set, getTemplate, initialValue = '') {
24-
return set.reduce((accumulator, item, index) => {
25-
return `${accumulator}${getTemplate(item, index)}`
26-
}, initialValue)
24+
return set.reduce((accumulator, item, index) => `${accumulator}${getTemplate(item, index)}`, initialValue)
2725
}
2826

2927
/**
@@ -48,15 +46,7 @@ export function render (replacedNodeSelector, htmlString) {
4846
export function escapeSpecialChars (str) {
4947
if (typeof str !== 'string') throw new TypeError('escapeSpecialChars function expects input in type String')
5048

51-
const escape = {
52-
'&': '&',
53-
'<': '&lt;',
54-
'>': '&gt;',
55-
'"': '&quot;',
56-
"'": '&#x27;',
57-
'`': '&#x60;',
58-
'=': '&#x3D;'
59-
}
49+
const escape = {'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#x27;', '`': '&#x60;', '=': '&#x3D;'}
6050

6151
return str.replace(/[&<>"'`=]/g, function (m) { return escape[m] })
6252
}

0 commit comments

Comments
 (0)