Only list top 5 wifi hotspots

This commit is contained in:
mmcwilliams 2018-01-09 13:39:43 -05:00
parent 71cfaff6c8
commit 757e3dd86d
1 changed files with 3 additions and 1 deletions

View File

@ -36,12 +36,14 @@ class Wifi {
const lines = stdout.split('\n')
let output = []
let line
let i = 0
for (let l of lines) {
line = l.replace('ESSID:', '').trim()
if (line !== '""') {
if (line !== '""' && i < 5) {
line = line.replace(quoteRe, '')
output.push(line)
}
i++
}
output = output.filter(ap => {
if (ap !== '') return ap