top 10 boilerplate ever

This commit is contained in:
biglyderv 2024-11-25 14:12:43 -05:00
commit 153c74bd22
17 changed files with 567 additions and 0 deletions

18
common/format.js Normal file
View file

@ -0,0 +1,18 @@
const escapeCodes = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
"'": '&#39;',
'"': '&quot;'
};
let format = {};
format.escape = function (str) {
return str.replaceAll(
/[&<>'"]/g,
tag => escapeCodes[tag]
)
};
export default format;