Hoist sanatise declaration

Function should be declared before trhe functions that use it, not after
This commit is contained in:
Zedifus 2022-10-22 18:11:54 +01:00
parent 6437f4fbd5
commit 1217f93c05

View File

@ -144,6 +144,10 @@
let typeInterval = 500;
let searchInput = document.getElementById('searchbox');
function sanitize(string) {
return string.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '');
}
searchInput.addEventListener('keyup', (e) => {
clearTimeout(typingTimer);
typingTimer = setTimeout(liveSearch, typeInterval);
@ -181,10 +185,6 @@
});
function sanitize(string) {
return string.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '');
}
function deleteItem(item) {
let safe_item = sanitize(item);
words.splice(words.indexOf(item), 1);