Skip to content
Permalink
1daf61570c
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
33 lines (30 sloc) 502 Bytes
'use strict'
/* eslint no-unused-vars: 0 */
const messages = ( function() {
let msgs = []
return {
extractData: payloadString => {
return payloadString
},
add: data => {
if(data === '') throw new Error('empty string parameter')
msgs[0] = data
},
get html() {
let html = ''
for(const msg of msgs) {
html += `<h2>${msg}</h2>`
}
return html
},
get all() {
return msgs
},
get count() {
return msgs.length
},
clear: () => {
msgs = []
}
}
})()