Added length filter

This commit is contained in:
Gleb Koval 2021-07-19 02:40:54 +01:00
parent c55f3d7bd9
commit 6c89ca79fe
No known key found for this signature in database
GPG Key ID: 120F2F6DA9D995FB
1 changed files with 16 additions and 14 deletions

View File

@ -58,20 +58,22 @@ export async function get(
let d: [string, number, number][][] = data;
res.end(
JSON.stringify(
d.map((values, idx) => {
return values.filter(value => {
return (
idx === 0 ||
idx === d.length - 1 ||
d[idx - 1].find(
v => v[0] === value[0]
)?.[2] !== value[2] ||
d[idx + 1].find(
v => v[0] === value[0]
)?.[2] !== value[2]
);
});
})
d
.map((values, idx) => {
return values.filter(value => {
return (
idx === 0 ||
idx === d.length - 1 ||
d[idx - 1].find(
v => v[0] === value[0]
)?.[2] !== value[2] ||
d[idx + 1].find(
v => v[0] === value[0]
)?.[2] !== value[2]
);
});
})
.filter(v => v.length > 0)
)
);
}