feat(api): decouple api from curriculum (#40703)

This commit is contained in:
Oliver Eyton-Williams
2021-02-22 07:53:59 +01:00
committed by GitHub
parent f4bbe3f34c
commit c077ffe4b9
172 changed files with 376 additions and 345 deletions

View File

@ -1,30 +0,0 @@
// Refer : http://stackoverflow.com/a/430240/1932901
function trimTags(value) {
const tagBody = '(?:[^"\'>]|"[^"]*"|\'[^\']*\')*';
const 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'
);
let rawValue;
do {
rawValue = value;
value = value.replace(tagOrComment, '');
} while (value !== rawValue);
return value.replace(/</g, '&lt;');
}
export { trimTags };