@textback/notification-widget
Version:
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.
20 lines (15 loc) • 478 B
JavaScript
function stringifyAttributes(attributesMap = {}) {
return Object.keys(attributesMap)
.map(key => {
let value = attributesMap[key];
if (value === null || typeof value === 'undefined') {
return ''
}
if (typeof value === 'object') {
value = JSON.stringify(value)
}
return `${key}='${value}'`
})
.join(' ');
}
export default stringifyAttributes;