mit-license/routes/utils.js
Richie Bendall f0a7eb433f
chore: Change promises back to await
Signed-off-by: Richie Bendall <richiebendall@gmail.com>
2019-06-21 20:13:50 +12:00

8 lines
257 B
JavaScript

const tags = {
'<': '&lt;',
'>': '&gt;',
'&': '&amp;',
};
exports.escapeTags = str => (str || '').replace(/[<>&]/g, m => tags[m]);
exports.stripTags = str => (str || '').replace(/<(?:.|\n)*?>/gm, '');
exports.validDomainId = s => /^[\w-_]+$/.test(s);