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; let d: [string, number, number][][] = data;
res.end( res.end(
JSON.stringify( JSON.stringify(
d.map((values, idx) => { d
return values.filter(value => { .map((values, idx) => {
return ( return values.filter(value => {
idx === 0 || return (
idx === d.length - 1 || idx === 0 ||
d[idx - 1].find( idx === d.length - 1 ||
v => v[0] === value[0] d[idx - 1].find(
)?.[2] !== value[2] || v => v[0] === value[0]
d[idx + 1].find( )?.[2] !== value[2] ||
v => v[0] === value[0] d[idx + 1].find(
)?.[2] !== value[2] v => v[0] === value[0]
); )?.[2] !== value[2]
}); );
}) });
})
.filter(v => v.length > 0)
) )
); );
} }