Skip to content

Commit

Permalink
Correct code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Troyer, Ronald committed Nov 2, 2020
1 parent 1d1be35 commit b4b145a
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions extension/chrome/src/js/userhosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@ document.getElementById('save_user_hosts').addEventListener('click', (event) =>

let hostsTextarea = document.getElementById('user_defined_hosts');
let hosts = hostsTextarea.value.
replace(/,/g, ' ').
replace(/;/g, ' ').
replace(/\t+/g, ' ').
replace(/\r+/g, ' ').
replace(/\n+/g, ' ').
replace(/[,;\r\n\t]+/g, ' ').
trim().
split(' ').
filter(host => {
return !!host; // This removes empty hosts
});
filter(Boolean);

if (hosts.length > 0) {
chrome.storage.sync.get('user_defined_hosts', oldhosts => {
Expand Down

0 comments on commit b4b145a

Please sign in to comment.