Deal with empty strings being inserted into the key
This commit is contained in:
parent
4391df8c1a
commit
f27aab1d3d
|
@ -42,6 +42,22 @@ function getKey(element: cheerio.Cheerio<cheerio.Element>) {
|
|||
const numbers = splitKey[0].split(" ");
|
||||
const stars = splitKey[1].split(" ");
|
||||
|
||||
// Not sure why, but an empty string is being inserted into the array
|
||||
numbers.forEach((value, i) => {
|
||||
console.log(value == "");
|
||||
if (value == "") {
|
||||
numbers.splice(i, i);
|
||||
}
|
||||
});
|
||||
|
||||
stars.forEach((value, i) => {
|
||||
if (value == "") {
|
||||
numbers.splice(i, i);
|
||||
}
|
||||
});
|
||||
|
||||
console.log(stars);
|
||||
|
||||
return { numbers: numbers, stars: stars };
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue