diff --git a/lib/util.js b/lib/util.js index 1a6da9b..27f4060 100644 --- a/lib/util.js +++ b/lib/util.js @@ -9,11 +9,14 @@ const parse = v => { } catch (e) {} } -const escapeHtml = s => - s - .replace(//g, '>') - .replace(/\//g, '/') +const escapeHtml = s => { + if (typeof s === 'string') { + return s + .replace(//g, '>') + .replace(/\//g, '/') + } +} export const parseRGBA = obj => `rgba(${obj.r},${obj.g},${obj.b},${obj.a})`