2019-05-03 12:29:53 -06:00
|
|
|
export function cloneObject(object) {
|
|
|
|
return JSON.parse(JSON.stringify(object));
|
|
|
|
}
|
|
|
|
|
2019-05-02 16:51:41 -06:00
|
|
|
export function removeTags(html) {
|
2019-05-03 16:10:41 -06:00
|
|
|
if (html) {
|
|
|
|
var tagBody = '(?:[^"\'>]|"[^"]*"|\'[^\']*\')*';
|
|
|
|
var tagOrComment = new RegExp(
|
|
|
|
'<(?:'
|
|
|
|
// Comment body.
|
|
|
|
+ '!--(?:(?:-*[^->])*--+|-?)'
|
|
|
|
// Special "raw text" elements whose content should be elided.
|
|
|
|
+ '|script\\b' + tagBody + '>[\\s\\S]*?</script\\s*'
|
|
|
|
+ '|style\\b' + tagBody + '>[\\s\\S]*?</style\\s*'
|
|
|
|
// Regular name
|
|
|
|
+ '|/?[a-z]'
|
|
|
|
+ tagBody
|
|
|
|
+ ')>',
|
|
|
|
'gi');
|
|
|
|
var oldHtml;
|
|
|
|
do {
|
|
|
|
oldHtml = html;
|
|
|
|
html = html.replace(tagOrComment, '');
|
|
|
|
} while (html !== oldHtml);
|
|
|
|
return html.replace(/</g, '<');
|
|
|
|
}
|
|
|
|
return html;
|
2019-05-03 12:29:53 -06:00
|
|
|
}
|