/** * Transform markdown string to html */ String.prototype.toHTML = function() { return DOMPurify.sanitize(marked(this.toString()).replace(//g, '
').replace(/<\/code>/g, '
')); } Array.prototype.removeItem = function(item) { const index = this.indexOf(item); if (index !== -1) { this.splice(index, 1); } return this; } function getCookie(key) { const split = document.cookie.split(';'); let cookies = {}; split.forEach(elt => { const val = elt.trim().split('='); cookies[val[0]] = val[1]; }); if(key !== undefined) { return cookies[key]; } return cookies; }