-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
37 lines (28 loc) · 794 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const fetchData = async () => {
const data = await fetch('https://codember.dev/data/files_quarantine.txt');
const text = await data.text();
const files = text.split('\n');
resolve(files);
};
const resolve = (files) => {
let real_files = [];
files.forEach((element) => {
[cadena, uncheck] = element.split('-');
let nueva_cadena = [];
let to_delete = [];
for (const letter of cadena) {
if (!nueva_cadena.includes(letter)) {
nueva_cadena.push(letter);
} else {
to_delete.push(letter);
}
}
let cadena_final = cadena.replace(new RegExp(to_delete.join('|'), 'g'), '');
if (cadena_final === uncheck) {
real_files.push(uncheck);
}
});
console.log(real_files[32]);
return real_files[32];
};
fetchData();